salve, ho creato questo script di redirect in base alla lingua del browser ma mi da un errore, cosa ho sbagliato ???
Codice PHP:
<?php
function redirect() {
$lang=substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
switch($lang) {
case "it": {
header("Location: redirect/index.html");
break;
}
case "en": {
header("Location: redirect/code-24/index.html");
break;
}
case "fr": {
header("Location: redirect/code-23/index.html");
break;
}
case "de": {
header("Location: redirect/code-22/index.html");
break;
}
case "es": {
header("Location: redirect/code-21/index.html");
break;
}
case "ru": {
header("Location: redirect/code-20/index.html");
break;
}
case "ja": {
header("Location: redirect/code-19/index.html");
break;
}
case "pt": {
header("Location: redirect/code-18/index.html");
break;
}
case "fi": {
header("Location: redirect/code-17/index.html");
break;
}
case "ar": {
header("Location: redirect/code-16/index.html");
break;
}
case "cs": {
header("Location: redirect/code-15/index.html");
break;
}
case "da": {
header("Location: redirect/code-14/index.html");
break;
}
case "no": {
header("Location: redirect/code-13/index.html");
break;
}
case "sv": {
header("Location: redirect/code-12/index.html");
break;
}
case "tr": {
header("Location: redirect/code-11/index.html");
break;
}
case "zh": {
header("Location: redirect/code-10/index.html");
break;
}
case "zh": {
header("Location: redirect/code-9/index.html");
break;
}
case "el": {
header("Location: greco.php");
break;
}
case "ga": {
header("Location: redirect/code-8/index.html");
break;
}
case "nl": {
header("Location: redirect/code-7/index.html");
break;
}
case "uk": {
header("Location: redirect/code-6/index.html");
break;
}
case "th": {
header("Location: redirect/code-5/index.html");
break;
}
case "pl": {
header("Location: redirect/code-4/index.html");
break;
}
case "ro": {
header("Location: redirect/code-3/index.html");
break;
default: {
header("Location: redirect/code-24/index.html");
}
}
}
redirect();
?>
grazie in anticipo