Forum Archive - [Solved]Rewrite rules

[Solved]Rewrite rules
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
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
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 dropdownOct 26, 2017 8:26 amReplies: 3Post by: danielesantosubito
[SOLVED] NOT WORKING, HELP PLEASE!Feb 12, 2017 4:53 pmReplies: 5Post by: TSM
Need help <SOLVED>Feb 6, 2017 1:48 pmReplies: 5Post by: blaxx
[solved] edit translations problemDec 15, 2011 10:05 pmReplies: 19Post by: slweb2
[Solved] Main site languageDec 9, 2016 4:39 pmReplies: 4Post by: trench

Try GTranslate with a free 15 day trial