Your question is complicated enough to answer by myself, but I would suggest you to install qTranslate
plugin. As the plugin’s description says:
Choose one of 3 Modes to make your URLs pretty and SEO-friendly. – The
everywhere compatible ?lang=en, simple and beautiful /en/foo/ or nice
and neat en.yoursite.com
So you can try to inspect the plugin’s code and see how they do it, or just use it at all.
Related Posts:
- remove “index.php” from permalinks
- How to get pretty URLs with add_query_arg in permalinks
- Getting the Site URL Including the Front Base
- Update URL Snippet to Canonical Permalink URL
- “.#[random-char-string]” being inserted at end of URLs
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- Pretty Permalinks
- How to create a permalink structure for posts in a specific category
- Remove subfolders from URL
- flexible rewrite ‘ramble’ URLs with WordPress
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- How to Modify Existing Rewrite Rules?
- custom permalink/shortlink with base62 encoded post ID
- Multilanguage URLs
- How to reset canonical URLs / fix redirect loop
- Change blog segment of URL
- WPML – how to get the permalinks to display also the default language
- Force wordpress to display page with same url structure as categories
- How can i have a custom post type with more slugs for each post?
- URL rewriting: removing the site’s basename for a specific category
- mod-rewrite exception? keep #hash in matching urls?
- Remove parent page from url
- Getting back a permalink from custom url
- Bulk append URL (add word to slug)
- Access posts while mod_rewrite is broken
- Can I change the URL structure for a CPT only?
- Multiple Taxonomy Items for Separate URLs
- WordPress keeps removing query var from the URL
- How to construct a dynamic rewrite rule for child pages that passes more than one query var
- Using a template file for a specific custom URL
- Extra url paths as variable
- Passing parameter through permalink structure
- rebuilding/ rewriting a url to make it SEO friendly
- a way to support totally different url structure
- How to change URL of my pages?
- Custom Permalink Base
- Include language variable in url
- How to get the perfect WordPress, WooCommerce, Custom Post Type pretty permalinks?
- How do I add /blog/ as a prefix to permalink structure for blog posts, tag pages, etc.?
- Permalink format: singular or plural
- Pretty permalinks for search results with extra query var
- Using $_GET variables in the URL?
- Including category-base in a post permalink results in 404
- How to prevent apostrophes and quotes from appearing in permalinks?
- Multiple post categories – single permalink
- Limiting the number of words or characters in the slug/permalink
- custom naming of search permalink /search/
- Change website URL without breaking links or images? WP 3.3
- Random Alphanumeric Key URLs
- Using WP rather than .htaccess to redirect pages/posts
- Rewrite URL for results of a custom WP_Query
- Using ‘Primary Category’ in URL
- How can I get the permalink of a post before it is published?
- Change permalinks with ACF values
- template_include not loading -instead goes to index.php
- Add a URL prefix to permalinks of News category and sub-categories of posts only
- echo post-permalink without http and www
- I need a custom permalink for my website
- Confusion about how a URL is being parsed
- Custom permalink for search and pagination
- Custom Post type and permalink settings
- Add custom post type name in term link?
- add_rewrite_rule not working for me
- Translate custom post type and taxonomy slug in URL?
- How can I get this custom post type permalink structure? %custom_post_type%-%taxonomy%-%term-postname%
- How to include sub directory in sitemap? [closed]
- Host frontpage via example.com and everything else via example.com/blog
- WordPress can generate numeric permalinks, which then 404
- Pre-populate Slug / Permalink with URL
- 404 error using Meta for Permalink rewrite
- Permalinks only for posts
- How to handle paging/pagination with a custom permalink?
- Visiting posts results in 404 errors after host migration
- Suddenly new posts have the default permalink instead of the post name
- Problem with parent page slug only in WordPress admin
- Custom URL rewrites for templates
- “-2” Being added to end of URL (no duplicate pages, no pages in trash)
- How to change custom post type, blog post and page permalink by template?
- Change permalinks for specific pages
- Custom permalink structure with %postname% in front of domain name
- How to get raw unwritten querystring
- How to Use metada Value in Url and is it possible? [duplicate]
- Post with no tag permalink problem
- Custom child page permalink
- Safest way to create a custom permalink
- Creating an alternate path for a page
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- Adding a ‘blogs’ prefix in the URL structure but only for blogs
- How to create a standard WP Page that has the same url as an archive
- How to change the URL using rewrite rule in wordpress
- Get value from URL with different types of parameters
- Multiple Permalink Patterns for one page
- Dynamically populate permalinks
- When using number in url it is redircting to same page but when using character it redirects to 404
- Once redirected by Rewrite rules, how can WordPress know the page?
- My wordpress site must be being affected by outside sources [duplicate]
- Change permalink in wp-property
- how to create several url aliases for a page
- Permalinks, how to show them in post
- Blog URL Structure – Multiple Taxonomies