2

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.

  • 1
    Please, explain a little bit more what do you exactly want to do. – Zistoloen Jan 27 '14 at 11:56
  • 1
    I think it is clear now. ty – Joeri Jan 27 '14 at 12:46
  • Removing file extensions like .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. – dan Jan 27 '14 at 16:02