Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to redirect an user depending on is browser locale ?

For instance, I'd like to redirect to a page called index.en.html all users who doesn't have their browser locale set to French.

Could I do this with Apache and .htaccess ?

share|improve this question
up vote 3 down vote accepted

Well looking at the documentation I found the MultiViews option.

Options MultiViews
AddLanguage fr .fr
AddLanguage en .en
<IfModule mod_negotiation.c>
     LanguagePriority fr en
share|improve this answer

You should be able to match the environment variable %{HTTP_ACCEPT_LANGUAGE} or the HTTP header Accept-Language (with %{HTTP:Accept-Language}) for fr or fr-fr.

share|improve this answer

You can use mod_rewrite and test for the Accept-Language header. For example:

RewriteCond %{HTTP:Accept-Language} en-us
RewriteRule ^(.*)$ /en-us/$1 [L]

Better yet, take a look at mod_negotiation

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.