Forum Archive - Redirect to subdomain in .htaccess using Accept-language

Redirect to subdomain in .htaccess using Accept-language
Dec 27, 2016 5:44 am by freebouba
Hi, I'm using GTranslate enterprise and I wish to redirect to subdomain in .htaccess using Accept-language from user browser. I'm using CDN cloudflare to. I try in .htaccess the following code: RewriteEngine On RewriteBase / RewriteCond %{HTTP:Accept-language} ^fr [NC] RewriteRule ^$ http://fr.mydomain.com [L,R=301] (Without => " rel="nofollow" target="_blank" information!) However I have the following message: Error too many redirect I try this code to: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^fr.mydomain.com$ [NC] RewriteCond %{HTTP:Accept-Language} ^fr [NC] RewriteRule .* http://fr.mydomain.com [R,L] (Without => " rel="nofollow" target="_blank" information!) But i have the same result: Error too many redirect Please, can you help me to achieve this redirection. Thanks.
Re: Redirect to subdomain in .htaccess using Accept-language
Dec 27, 2016 4:37 pm by Edvard
Hi, We never suggest doing that. It confuses your visitors. If they come to your website from search engine results pages they will land on a correct language. If they come from links in other websites, they will also land on a correct language. Thanks!
Re: Redirect to subdomain in .htaccess using Accept-language
Dec 28, 2016 2:09 am by freebouba
Hi, yes I understand that can confuses my visitors. However if I wish to do it, can you tell me how to do it? Thanks.
Re: Redirect to subdomain in .htaccess using Accept-language
Dec 28, 2016 4:24 am by Edvard
Hi, In order to not create a redirect loop, you have to make sure that you do not redirect our server. For that you need to check if the request is from our network. You can do that by checking X-GT-Lang header which will be set if the request is from our network. Something like RewriteCond %{HTTP:X-GT-Lang} ^$. Thanks!
Re: Redirect to subdomain in .htaccess using Accept-language
Dec 28, 2016 4:53 am by freebouba
Hi, Ok it's understood. Thanks for quick reply.
Re: Redirect to subdomain in .htaccess using Accept-language
Dec 28, 2016 6:04 am by Edvard
You are welcome!

SIMILAR TOPICS

Large numbers of crawl errors with double language codeJan 24, 2019 1:43 amReplies: 1Post by: natastna2
Translate website to any specific language, on page loadJan 19, 2019 6:49 amReplies: 1Post by: Leaon7756
Graphic translation for every language is missingDec 19, 2018 7:54 amReplies: 1Post by: Daryl Dixon
How to remove mobile Language Select Button transparencyDec 5, 2018 10:06 pmReplies: 10Post by: JeffTR
Change language automaticallyNov 26, 2018 9:29 pmReplies: 3Post by: Antilb

Try GTranslate with a free 15 day trial