0

I get tons of traffic from India and I am hosting in the USA.

So, I was thinking, is it possible that when an Indian visitor hits my site then they are redirected to an India html page within my site? (Reason for this would be to offer them Indian-related services etc).

I have been searching but with no results. Maybe my search terminology is wrong? Should I be referring to a 'sniffer script'?

Thanks

Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
Henry
  • 5,195
  • 7
  • 21
  • 34
  • possible duplicate of [GeoIp redirect specific country Traffic to country domain?](http://stackoverflow.com/questions/19648241/geoip-redirect-specific-country-traffic-to-country-domain) – peko Aug 19 '14 at 10:43
  • You can get their country from their IP-info. – sridesmet Aug 19 '14 at 10:43
  • Duplicate of http://stackoverflow.com/questions/12553160/getting-visitors-country-from-their-ip – sridesmet Aug 19 '14 at 10:43

1 Answers1

2

First, I'd go for $_SERVER["HTTP_ACCEPT_LANGUAGE"] - if this variable contains indian language code.

Second, because it's a little slower to detect, install MaxMind (free) geo IP database (refer to different tutorials on the net) and check the IP for indian origin.

If either of both is true, your best bet is to store this information in memcache so you only have to do it once (geoip lookups cost time).

Depending on this information you can present a different page.

Daniel W.
  • 31,164
  • 13
  • 93
  • 151