I made a multilingual PHP website framework. The framework serve the HTML "container" (the visual template of the site) and the page serve the content (in the current language).
I use the following to determine the current language:
1) $_GET['lang'] if set.
2) $_SESSION variable if set.
3) $_COOKIE if set.
4) Default language (English).
The user can change the language anytime on any page.
All the languages are in the same file. For example, index.php can be served in English, French, German...
This setup is very easy to maintain since if you change the visual template (the container), all the pages of the site will be updated at once. Same thing with the content... For example, you set the content layout of index.php once and then edit the content for each language.
My setup has one problem... It's not very SEO oriented (yet). Since www.foo.net/index.php can be served in many languages, Google and friends only index my pages in the default language.
Now I want to implement SEO URLs. So far my system support language overrides: if the session is set to French and that you type index.php?lang=en the page will be served in English instead of French.
I would like to use something like:
I know it's doable with .htaccess (I think) but I would like to know how to do it... I would like to avoid redirect things since I don't want to "break" the back button.
Many thanks for your thoughts/hints!