开发者

Redirect traffic from certain country

开发者 https://www.devze.com 2022-12-13 21:24 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消