jeudi 30 avril 2015

htaccess language redirect loop chrome

Hey guys I am new to the .htaccess stuff and I am encountering a problem.
My goal is to have every Dutch and Belgium user redirected to bloggerlist.nl and the remaining should be redirected to bloggerlist.co.

I tried some other threads but it didn't work for me, so here's my htaccess for bloggerlist.nl:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteCond %{HTTP_HOST} !^bloggerlist.co [NC]
RewriteCond %{HTTP:Accept-Language} (en) [NC]
RewriteRule ^(?!en/) http://ift.tt/1GIbpcu [R,L]

</IfModule>

# END WordPress

And the bloggerlist.co htacces is the same except for the three lines:

RewriteCond %{HTTP_HOST} !^bloggerlist.nl [NC]
RewriteCond %{HTTP:Accept-Language} (nl) [NC]
RewriteRule ^(?!nl/) http://ift.tt/1GIbpcy [R,L]    

So this works in safari etc. but not in chrome. I think this is due to chrome having multiple supported languages in the browser ( English and Dutch) and the htaccess detects those languages and then it keeps redirecting them. With safari the browser language is on Dutch only, so this works as desired.

So I had the idea to don't redirect anymore if the HTTP_HOSTS is already from bloggerlist.nl or bloggerlist.co.

I didn't implement the Belgium language yet. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire