我想发送谁在他们的地址栏中使用国家代码的用户被重定向到正确的子页面使用htaccess文件。
例如: www.example.nl重定向至: www.example.com/nl
有什么建议吗?
发布于 2014-04-03 17:19:32
我建议你使用GeoIP服务PHP来找出你的访问者的国家,然后进行重定向。
include("geoipcity.inc");
include("geoipregionvars.php");
$gi = geoip_open("/usr/local/share/GeoIP/GeoIPCity.dat",GEOIP_STANDARD);
$getcountry = geoip_record_by_addr($gi,$_SERVER['REMOTE_ADDR']);
if ( $getcountry->country_code == "NL" ) {
header('Location: www.example.com/nl');
}类似于NL重定向
https://stackoverflow.com/questions/22832938
复制相似问题