Htaccess takes language from browser and redirects

I have some questions to accept languages ​​and htaccess. I have a multilingual homepage. The root directory contains only robots.txt, .htaccess, sitmaps and directories for de for German and en for English. I really need the browser to detect the correct language. If your languages ​​are not German or English, select English as your default language.

The problem is that the forwarding is not working correctly. I am typing than redirecting to without any css styles. When I click on the link I am redirected to hxxx: //

My domain does not exist. What's wrong? Please take a look at my .htaccess.




Options +FollowSymLinks

RewriteEngine On
RewriteBase /

RewriteCond %{REMOTE_ADDR} !^10\.30\.7\.1(?:37|38|39|40)$
RewriteRule ^{HTTP_HOST}%{REQUEST_URI} [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]



source to share

All Articles