SEO and Usability Expert
Call Me: 1-813-421-4127

Redirecting visitors for multi-language sites

Multi-language SEO TipsHere’s a script you can use on your home page to redirect visitors to the right language version of your site, based on their browser language settings.

This assumes you have the English version of your site in the root level, and other languages in sub-folders; /fr, /de, /dk, etc.

ASP Redirect:

lang = Request.ServerVariables(“HTTP_ACCEPT_LANGUAGE”)
real_lang = Left(lang,2)
‘Response.Write real_lang
Select case real_lang
case “en”
Response.Redirect “/default.htm”
case “fr”
Response.Redirect “/fr”
case “de”
Response.Redirect “/de”
case else
Response.Redirect “/default.htm”

End Select


PHP Redirect:

if (substr($lang, 0, 2) == ‘de’)
header(“Location: /de”);
elseif (substr($lang, 0, 2) == ‘fr’)
header(“Location: /fr”);
} else {
// stay on this page


Tip: when setting up language sub-folders, it’s good practice to use their 2-letter language code. This should make it easier for search engines to understand.
Here’s a good list for the language codes:

The following two tabs change content below.
Hi. I'm Vince, a web guy based in Tampa, Florida. I've been building web sites since 1996, and I have great passion for design and usability. I have a wonderful family and 2 great dogs. Feel free to say "Hi", and checkout my latest e-books.

Latest posts by Vince (see all)

Leave a Reply

Captcha: *