Jump to content

php redirection


michaelowen

Recommended Posts

Hi i have multilang website when you entered homepage default site if you are from polonia it redirect to you polonia page this script works perfect but the problem is if you are trying to see www.server.com instead server.pl and if you are from polonia you not able see because of redirection on google they solved this problem like www.google.com/ncr post is there something i can do like this for example server.com/ncr and this will disable redirect function

would be nice if you help me to how to do it

 

thanks in advance

 

<?php function redirect()
{
$Destination['en-au'] = 'http://www.server.com.au'; //austr$Destination['pl'] = 'http://www.server.pl';   //polonia
$Destination['se'] = 'http://www.server.se';  //sweden

$DefaultDestination = 'http://www.server.com';  //us
$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;
}
}

redirect();

?>

[/code]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.