jeudi 30 avril 2015

htaccess accept language from the browser and redirect

I have some questions to accept languages and htaccess. I have a multilanguage homepage. In the root directory are only the robots.txt, .htaccess, sitmaps and the directories for the languages de for german and en for english. What I do need is that the browser indenified the right language. If are not the languages german or english, then choose english as the default language.

The problem is that the forwarding does not work correct. I type than I am redirected to wihtout any css styles. When I click on a link than I am redirected to hxxx://

My domain is not there. What is wrong? Please take a look to my .htaccess.

Thank you for your help. Sorrry I can't post more than 2 links.




Options +FollowSymLinks

RewriteEngine On
RewriteBase /

RewriteCond %{REMOTE_ADDR} !^10\.30\.7\.1(?:37|38|39|40)$
RewriteRule ^} [R=301,L]

RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^$ [L,R=301]

RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteRule ^$ [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

# for all other languages use English
RewriteRule ^$ [L,R=301]

RewriteRule ^(en|de)/?$ index.php?lang=$1 [QSA,NC,L]

Aucun commentaire:

Enregistrer un commentaire