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 and the remaining should be redirected to

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

# 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} !^ [NC]
RewriteCond %{HTTP:Accept-Language} (en) [NC]
RewriteRule ^(?!en/) [R,L]


# END WordPress

And the htacces is the same except for the three lines:

RewriteCond %{HTTP_HOST} !^ [NC]
RewriteCond %{HTTP:Accept-Language} (nl) [NC]
RewriteRule ^(?!nl/) [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 or

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

Aucun commentaire:

Enregistrer un commentaire