Page 1 of 1

HTTP_ACCEPT_LANGUAGE: problems with implementing

Posted: Sat Mar 14, 2009 9:04 pm
by opawaldburger
hi friends,

i've got a problem implementing an automatically language-detection on my side. it does not work. i have got a german side (benjamin-karl.com/de) and an english one (benjamin-karl.com/en). maybe i do something completly wrong, so i just write what i'm doing:

i take the script from the internet and paste it into a template (i call it "start"). then i create a new side using the start-template.

now when i open the side benjamin-karl.com/start nothing happens. usually when i open the side, the script should redirect me to the german side, but it doesn't. here's the script i'm using but i don't think that's the weak point!

Code: Select all

<?php
{
$lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
if (substr($lang, 0, 2) == 'de')
{
header("Location: index.php?page=de");
} else {
header("Location: index.php?page=en");
}
}?>
what could possibly be wrong or which is the mistake am i doing?

greez, toby