Hi i have scripts that redirect page for language settings thanks the guy who helped me sorted out my first problem now i am facing another problem there is a script working in www.server.com if you type only www.server.com now i created function and if you type www.server.com?redir=1 this function will not work and site will come but then my script doesnt work with ?redir=1 i think only solition have some cookie or session if someone type www.server.com?redir=1 everytime it checks and if redir ok directly goes to www.server.com without problem this problem i face because for example if you are from italy and want to see server.com you can't because server directly send you server.it all the time i put the link like www.server.com?redir=1 to disable redirect function page is okay but script not working due to address.
<?php
function redirect()
{
$Destination['en-au'] = 'http://www.server.com.au';
$Destination['pl'] = 'http://www.server.pl';
$Destination['it'] = 'http://www.server.it';
$lang = preg_replace('/;.*$/','',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$lang = preg_replace('/,.*$/','',strtolower($lang));
$dest = '';
if( isset($Destination[$lang]) ) { $dest = $Destination[$lang]; }
if( empty($dest) )
{
$lang = substr($lang,0,2);
if( isset($Destination[$lang]) ) { $dest = $Destination[$lang]; }
else { $dest = $DefaultDestination; }
}
if( ! empty($dest) )
{
header("Location: $dest");
exit;
}
}
if (!isset($_GET['redir'])) redirect(); // if www.server.com/?redir=1 run this func. i dont want /?redir=1
....
....
....
....
?>