I have a landing page www.A.com. I want it to redirect to www.A.com/x for tier 1 counties and www.A.com/y for all other countries. All webites were built and work well. I have put a geo.php in th root folder, redirect all traffic to www.A.com/geo.php It works ok to redirect to www.A.com/y but not www.A.com/x although vistors come from tier 1 countries
The code:
<?php
$a = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR']));
$countrycode= $a['geoplugin_countryCode'];
if (in_array($countrycode, array('us','gb','at','de','ca','ch','fr','it','nl','au','nz','sg','ch')))
header( 'Location: http://www.A.com/x' ) ;
else
header( 'Location: http://www.B.com/y' ) ;
?>
Please check if it's right. Did I miss something?