0

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

How can I do this in php?

Felix Yan
  • 14,841
  • 7
  • 48
  • 61
gpwj
  • 1

2 Answers2

1

Answered here: Redirect depending on the Country?

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

Community
  • 1
  • 1
micahwittman
  • 12,356
  • 2
  • 32
  • 37
0

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.

Sarfraz
  • 377,238
  • 77
  • 533
  • 578