gpwj
gpwj

Reputation: 1

Redirect traffic from certain country

I want to redirect all traffic coming from Thailand to another domain.

How can I do this in php?

Upvotes: 0

Views: 938

Answers (2)

micahwittman
micahwittman

Reputation: 12476

Answered here: Redirect depending on the Country?

PHP examples in one case here: http://ipinfodb.com/ip_location_api.php

Upvotes: 1

Sarfraz
Sarfraz

Reputation: 382881

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.

Upvotes: 0

Related Questions