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?
- Passing and retrieving query vars in wordpress
- Rewrite Rule for Multilingual Website, Like qTranslate?
- Date based URLs for custom posts and pagination
- Removing hierarchical pages in the permalink
- How to custom change author base without $this->front?
- How to remove the index.php in the url?
- Make attachment pages require a base url
- How to Remove -14 from WordPress URL (Permalink)
- Rewrite URL Parameter And Force ‘Pretty’ Permalink
- display URL or permalink instead of page title in dashboard
- Change permalink rule if category is called “uncategorized”
- Incorrect 404 for pages when using permalink, a static front page, and posts page
- How to improve WordPress security by hiding non public facing files?
- Get canonical link
- CSS not loaded when omitting www. part of URL
- Is it possible to keep all special letters for foreign languages in slug as in title?
- Non latin post slug truncate
- Remove -2 from URL; no duplicate pages, no images, no pages in trash
- Remove subcategory and category with some rules from permalink
- Passing the JQuery string to Worldpress URL
- Permalinks only for posts
- Permalinks settings
- Edit permalink for certain pages
- Visiting posts results in 404 errors after host migration
- Suddenly new posts have the default permalink instead of the post name
- Two URLs of one post is available
- Redirecting “wrong” but working links to their canonical URL in order to prevent search engine penalties (e.g. /123/ at the end of URLs)
- Custom permalink structure with %postname% in front of domain name
- How can I set up a secondary permalink structure?
- WP-e-commerce (getshopped) – Annoying permalink issue [closed]
- How to Use metada Value in Url and is it possible? [duplicate]
- How do I rewrite attachment urls when permalink structure contains %category%?
- IIS7.5 URL rewrite pboblem on index page
- Custom child page permalink
- Safest way to create a custom permalink
- How do I structure my permalinks in WordPress?
- Creating an alternate path for a page
- How to change URL from /%postname%/ to custom-name/%category%/%year%/%monthnum%/%day%/%postname%/
- Create different permalinks for same post
- WordPress Attachment Page URL Rewrite!
- Customize URL for specific tags archive
- Add #primary at the end of navlink permalinks on single posts
- Why does one of my pages not have the option to edit the link?
- WP permalink working, but why content doesn’t display
- Giving specific category posts its own permalink structure returns 404
- WordPress Multisite ABSPATH and get_home_path() to check for htaccess or web.config file
- Flushing rewrite rules enables to see an article, but I didnt change anything
- Redirect page to homepage, keeping URL
- Adding query string to multiple page urls in a WordPress function
- How can I put WordPress in a directory but keep just the home page at the domain root?
- Updates all internal links on permalink update
- how to have same rewrite rules for 2 different post type?
- Permalink structure /page/page/cpt-post gives 404 with pagination
- What permastrusture tags are generated out of the box right after creating custom post types and taxonomies?
- Rewrite posts url as they’re all children of a page
- Multiple Permalink Patterns for one page
- Issues with WordPress permalinks
- WordPress permalink still not working (error or not understood?)
- Update permalinks after domain change
- how to create several url aliases for a page
- Single product link in woocomerce
- Blog URL Structure – Multiple Taxonomies