I'm having problems with my .htaccess file.
RewriteEngine On
RewriteCond %{HTTP:Accept-Language} (fr) [NC]
RewriteRule .* http://www.example.com/frans [R,L]
RewriteRule .* http://www.example.com/nederlands [R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
Can anyone please help?
I want it to detect the browser language of the client, then redirect French to /frans
, and all other languages to /nederlands
.
Also I want to show the URLs without .html
or .php
at the end, so clean URLs.
.php
can be problematic - see this answer and comments: webmasters.stackexchange.com/questions/52518/… There are many questions here on how to remove.html
. You might do better to look at those, and edit your question to be specific to just redirecting based on the language, since it's really too broad otherwise.