help with /en i need /en/ by htaccess

Popular automatic website translation tool

help with /en i need /en/ by htaccess

Postby davide81 » Sat Sep 29, 2012 6:48 pm

Hi, i have 1 problem,
actually i have 2 page with same contents: domain.com/en and domain.com/en/
I want to add the simbol / by htaccess at the end of all language directory.
Can someone help me please?

My site is in html and my htaccess content is:

RewriteEngine On
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&url=$2 [L,QSA]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1&force_translation=1 [L,QSA]
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]


thanks and regards
Davide
davide81
 
Posts: 14
Joined: Mon Nov 28, 2011 9:22 pm

Re: help with /en i need /en/ by htaccess

Postby Yana » Sun Sep 30, 2012 12:54 am

Hi,
The following lines should fix the issue.
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]

Could you please send me your domain name, so I can check it and understand what the problem is?

Also you can try to add this rule
RedirectMatch ^/([a-z]{2}) /$1/
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: 4135
Joined: Thu Jan 12, 2012 6:21 pm

Re: help with /en i need /en/ by htaccess

Postby davide81 » Sun Sep 30, 2012 12:07 pm

I try with RedirectMatch ^/([a-z]{2}) /$1/ but not work and show this error: This site is not redirecting properly. In blowser url appear this line:

"domain.com/in/?lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url=&lang=in&url="

Someone can help me please??

Regards,
Davide
Last edited by davide81 on Tue Oct 02, 2012 6:25 pm, edited 1 time in total.
davide81
 
Posts: 14
Joined: Mon Nov 28, 2011 9:22 pm

Re: help with /en i need /en/ by htaccess

Postby davide81 » Tue Oct 02, 2012 6:03 pm

i see that if i create directory "en" in the root of site the redirect work property but the link become:
domain.com/en/?lang=en&force_translation=1
To remove "?lang=en&force_translation=1" after domain.com/en/ i modified in htaccess this line:
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php [L,QSA]

Is this correct way?

Now work all fine, thank you!
davide81
 
Posts: 14
Joined: Mon Nov 28, 2011 9:22 pm

Re: help with /en i need /en/ by htaccess

Postby Yana » Wed Oct 03, 2012 2:52 pm

Hi,
yes, you need to remove force_translation=1 from .htaccess .
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: 4135
Joined: Thu Jan 12, 2012 6:21 pm


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux
cron