(2013-09-17, 01:15:54)anvold Wrote: Help me, please
I cant solve a problem with multilanguage:
My site has 2 languages, basic (en) and additional (de). Basic fancy urls must be without any suffix(for example http://mysite.com/page/), additional - with suffix "/de" (for example http://mysite.com/de/page/). If user's browser language is the same that basic, it's OK, but if not, all pages without suffix transform in german.
It's because urls has "lang" parameter only if i switch language. Modrewrite transforms urls without this parameter to default browser language. How to make urls to include "lang" parameter always? In this case it will be possible to set unique url to each language version
I have already made a website with the same scenario you are after.
http://ubytovanisetek.cz/ - the default language is Czech and it's Czech until you switch to English. Then, it stays English until you switch back. When the site's in English, there's "/en/" in the URL. When it's in Czech, there is no parameter.
In the website's settings, I use this custom permalink structure:
Code:
%nondefaultlanguage%/%parent%/%slug%/
And the .htaccess part for this setting (you have to replace the original RewriteRules with this one)
Code:
RewriteRule ^/?$ cs/ [R,L] # optional
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(cs|en)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(cs|en)/?$ index.php?lang=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$2&lang=cs [QSA,L]
Try it, it should work.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
» The little I did for GetSimple