Hi guys,
I have a site which supports three different languages, English, Polish & Italian. I am detecting the user's language and then redirecting them to the site which matches their language. So for example if you go to the site using a Polish browser you are redirect to pl.blog.website.
Everything works fine except in IE6/IE7 🙁
The problem is that if you have a secondary locale in your browser such as Polish or Italian then IE6/7 brings you to the Polish site before the English sit, even if English is the default language on your browser. This is because pl appears in the if/else statement before English.
I need to ammend the below code so that only the default language gets returned as the $lang variable. Any ideas on how I can do this?
<?php
$lang = ($_SERVER['HTTP_ACCEPT_LANGUAGE']);
if(ereg("pl", $lang)) {
header("location: http://pl.blog.website.com");
}
else if(ereg("it", $lang)) {
header("location: http://it.blog.website.com");
}else {
header("location: http://en.blog.website.com");
}
?>