GetSimple Support Forum
I18N language in URL index page problem - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: I18N language in URL index page problem (/showthread.php?tid=2537)



I18N language in URL index page problem - ChriS - 2012-01-19

Is someone using GS 3.0 and I18N 2.5.1 Navigation with "Include Language in URL"?
While without "%language%/%parent%/%slug%" permalink setting and edited .htaccess everything works fine, afterwards I have problems with the index pages. Every other page (Parents and Subpages) is working, for example "/de/vacations/". But not the link to the index pages:
/de/
/it/
/en/
Everyone gives a "Oops! Page not found!" with I18N edited Innovation Theme.
The link to the root "/" shows the index page of the Page Management Setting "Language of all pages with URLs without language code (like "index"), e.g. "de": ". In my case this is "de".
Here the .htaccess-code
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(de|it|en)/(.*?/)?([A-Za-z0-9_-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
Even with using copy and paste from mvlcek.bplaced.net/get-simple/i18n there was no change in the behaviour.
After some hours of testing (on local WAMP-Server) I ask me if someone can reproduce this or do I have a nasty bug in my code?


I18N language in URL index page problem - yurifanboy - 2012-01-19

Nope just an issue with your .htacess rewrite rules I think
Try this
RewriteRule ^/?$ en/ [R,L] # redirect to language of your choice
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en|de)/(.*?/)?([A-Za-z0-9_-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(en|de)/?$ index.php?lang=$1 [QSA,L] # handle index page without 'index'
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]

or this
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^/?$ en/ [R,L] # redirect to language of your choice
RewriteRule ^(en|de)/(.*)$ $2?lang=$1 [QSA,DPI] # replace with your languages
RewriteRule ^(.*);(\d+)([^\d/][^/]*)?/?$ $1$3?page=$2 [QSA,DPI] # for use with pagify plugin
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
RewriteRule ^ index.php [L] # for everything else show home page


I18N language in URL index page problem - ChriS - 2012-01-19

yurifanboy Wrote:Nope just an issue with your .htacess rewrite rules I think ...
Very thank you yurifanboy, I'm to bad in RewriteCode to do something like this by myself. Both of your solutions work for me, however I qouted out the "redirect to language of your choice" because it is an unwanted behaviour and use now the first one:
Code:
# RewriteRule ^/?$ de/ [R,L]   # redirect to language of your choice. Quote out if undesired.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en|de|it)/(.*?/)?([A-Za-z0-9_-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(en|de|it)/?$ index.php?lang=$1 [QSA,L]   # handle index page without 'index'
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]

What's even better: if you enter a URL without language code, it shows the browsers best fitting language. So you can use this perfectly in Signatures, letters, etc. for multilanguage users: for example "mydomain.info/vacations/" shows the page normally under ".../de/vacations/" or ".../it/vacations/" or ".../en/vacations/" in my case. When the user clicks on the navigation menu it continues in the chosen language. Very nice.
So I have to rethink about my wish to build different (freely) URLs for every language. Every solution has advantages and disadvantages (see my post under "Support for multilanguage sites, Internationalization (I18N)").