New answers tagged

1

The rewrite loop is actually caused by rules later in your script: RewriteRule ^(en|it)/(.*) $2?lang=$1 [QSA] RewriteRule ^([^/]+)$ index.php?op=$1 [L,NS,QSA] index.php Having redirected the user to /en/ (with the Accept-Language rules), the first directive here rewrites the request back to ?lang=en (no URL-path) but the second directive then fails to ...


2

This answer comes from memory. If I'm 100% correct with the syntax, you'll want to replaced your 4 commented out lines of code with: RewriteCond %{REQUEST_URI} !^/en(.*)$ RewriteCond %{HTTP:Accept-Language} ^en [NC] RewriteRule ^$ https://www.example.com/en/ [L,R=301] RewriteCond %{REQUEST_URI} !^/it(.*)$ RewriteCond %{HTTP:Accept-Language} ^it [NC] ...



Top 50 recent answers are included