[Solved]Rewrite rules

Popular automatic website translation tool

[Solved]Rewrite rules

Postby clicksafe » Wed Jul 11, 2012 11:41 am

About the rewrite rules from gtranslate.
Code: Select all
# 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:
Code: Select all
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?
clicksafe
 
Posts: 22
Joined: Sat Jun 23, 2012 8:11 pm
Location: Free Safe Internet Advice

Re: Rewrite rules

Postby Yana » Wed Jul 11, 2012 8:32 pm

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]
Regards,

Yana Ghahramanyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Yana
 
Posts: 4133
Joined: Thu Jan 12, 2012 6:21 pm

Re: Rewrite rules

Postby clicksafe » Sun Jul 22, 2012 12:40 am

THANK YOU VERY MUCH !!!
Sorry for the late answer but i was in hospital for 10 days ...
Thanks again for this solution !
clicksafe
 
Posts: 22
Joined: Sat Jun 23, 2012 8:11 pm
Location: Free Safe Internet Advice


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux