[Solved]Rewrite rules
Jul 11, 2012 7:41 am by clicksafe
Jul 11, 2012 7:41 am by clicksafe
About the rewrite rules from gtranslate.
# BEGIN gtranslate config
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /$1/$3 [R=301,L]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$ /$1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/(.*)$ /gtranslate/translate.php?lang=$1&force_translation=1&url=$2 [L,QSA]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1&force_translation=1 [L,QSA]
# END gtranslate config
This is the code on my site, but one thing needs to be done: if someone enter http://mysite/ru/ it will translate the page to ru , while it's not in my list off available languages.
Means that ALL the languages are available ...
Is it possible to change this?
I have Dutch as main language and English + French as translated language.
For NOW i enter this in my .htaccess to deny the most used "other" languages:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^ru.*$ http://mysite.com/en/over-clicksafe-klikveilig/disclaimer-privacy/ [R=301,L]
RewriteRule ^de.*$ http://mysite.com/en/over-clicksafe-klikveilig/disclaimer-privacy/ [R=301,L]
These rules will deny that you can translate it into RU or DE.
Is it possible to change the .htaccess rules, so ONLY my selected languages are available?
Re: Rewrite rules
Jul 11, 2012 4:32 pm by Yana
Jul 11, 2012 4:32 pm by Yana
Hi,
Yes, It's possible. You can replace ([a-z]{2}|zh-CN|zh-TW) with the languages you want to use.
In this case it should be (en|fr)
RewriteEngine On
# gtranslate config
RewriteRule ^(en|fr)/(en|fr)/(.*)$ /$1/$3 [R=301,L]
RewriteRule ^(en|fr)/(en|fr)$ /$1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en|fr)/(.*)$ /gtranslate/translate.php?lang=$1&force_translation=1&url=$2 [L,QSA]
RewriteRule ^(en|fr)$ /gtranslate/translate.php?lang=$1&force_translation=1 [L,QSA]
Re: Rewrite rules
Jul 21, 2012 8:40 pm by clicksafe
Jul 21, 2012 8:40 pm by clicksafe
THANK YOU VERY MUCH !!!
Sorry for the late answer but i was in hospital for 10 days ...
Thanks again for this solution !
SIMILAR TOPICS
[SOLVED]double dropdown | Oct 26, 2017 8:26 am | Replies: 3 | Post by: danielesantosubito |
[SOLVED] NOT WORKING, HELP PLEASE! | Feb 12, 2017 4:53 pm | Replies: 5 | Post by: TSM |
Need help <SOLVED> | Feb 6, 2017 1:48 pm | Replies: 5 | Post by: blaxx |
[solved] edit translations problem | Dec 15, 2011 10:05 pm | Replies: 19 | Post by: slweb2 |
[Solved] Main site language | Dec 9, 2016 4:39 pm | Replies: 4 | Post by: trench |