hello can u add redirect script so if visitor from US will redirect to http://mydomain.com/page1 and if from UK will redirect to http://mydomain.com/page2 ..., else will go to http://mydomain.com/page3
hello can u add redirect script so if visitor from US will redirect to....
hello can u add redirect script so if visitor from US will redirect to ........
<?php
include("geoip.inc");
$ip = $_SERVER['REMOTE_ADDR'];
$gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
$returarray = array(geoip_country_code_by_addr($gi, $ip),geoip_country_name_by_addr($gi, $ip));
//return geoip_country_code_by_addr($gi, $ip);
geoip_close($gi);
echo $returarray[0];
if($returarray[0] == "US"){
header( 'Location: Url_For_US_Visitors');
}
else if($returarray[0] =="GB"){
header( 'Location: URL_For_UK_Visitors');
}
else
{
header( 'Location: URL_For_Other_Visitors ');
}
?>
header( 'Location: *********');
You would need to addhello, which code to add if i wanna add more country to redirect? thx
else if($returarray[0] =="DESIRED COUTNRY CODE"){
header( 'Location: DESIRED URL');
}
else
{
header( 'Location: URL_For_Other_Visitors ');
}
<?php
include("geoip.inc");
$ip = $_SERVER['REMOTE_ADDR'];
$gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
$returarray = array(geoip_country_code_by_addr($gi, $ip),geoip_country_name_by_addr($gi, $ip));
geoip_close($gi);
if($returarray[0] == "US"){
header( 'Location: Url_For_US_Visitors');
}
else if($returarray[0] =="GB"){
header( 'Location: URL_For_UK_Visitors');
}
else{
header( 'Location: URL_For_Other_Visitors ');
}
?>
please download this fileI get this error when I go to index.php
Fatal error: Cannot redeclare geoip_country_code_by_name() in /home/domain/public_html/GeoTargetting/geoip.inc on line 390
and replace here173.242.114.124/GeoTargetting/geoip.rar
you can see its working fine at my server at following URL/home/domain/public_html/GeoTargetting/
173.242.114.124/GeoTargetting
yes you can, you will just need to modify little php code and it will do as you wanted. Please read relevant information in post #24 of this thread.hey, can i use this to redirect someone to a specif page based on their city location?