I want to redirect all traffic c开发者_运维知识库oming from Thailand to another domain.
How can I do this in php?
Answered here: Redirect depending on the Country?
PHP examples in one case here: http://ipinfodb.com/ip_location_api.php
You need to get IP of the coming user using:
$_SERVER['REMOTE_ADDR'];
Now you have the IP, now you need to figure out whether this IP's intials represent Thailand and if so, you should redirect users then.
Find out Thailand initials of IP using online services like ip2country.
精彩评论