0

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'; //australia
$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();

?>
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by michael1999
1

You could put a link on your home page that bypasses redirection and use a switch on the URL to enable it.

<a href='www.server.com?bypass=1'>US</a>

then in your PHP

if (!isset($_GET)) redirect();

Edited by brewbuff: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.