Forum Archive - help with /en i need /en/ by htaccess

help with /en i need /en/ by htaccess
Sep 29, 2012 2:48 pm by davide81
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
Re: help with /en i need /en/ by htaccess
Sep 29, 2012 8:54 pm by Yana
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/
Re: help with /en i need /en/ by htaccess
Sep 30, 2012 8:07 am by davide81
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
Re: help with /en i need /en/ by htaccess
Oct 2, 2012 2:03 pm by davide81
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!
Re: help with /en i need /en/ by htaccess
Oct 3, 2012 10:52 am by Yana
Hi, yes, you need to remove force_translation=1 from .htaccess .

SIMILAR TOPICS

Potential threat identified in .htaccessMar 1, 2017 7:30 pmReplies: 3Post by: Hannah
Redirect to subdomain in .htaccess using Accept-languageDec 27, 2016 5:44 amReplies: 5Post by: freebouba
htaccess (301 redirects) CacheSep 19, 2016 9:36 amReplies: 3Post by: belgor
Need updated htaccess rules for Windows IIS web.configMay 24, 2016 2:03 pmReplies: 5Post by: mjbradley85
Do we need .htaccess changes for enterprise versionApr 25, 2016 5:18 pmReplies: 1Post by: sadashiv

Try GTranslate with a free 15 day trial