• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

Redirect USA traffic away from a website

Is there a way to redirect traffic away from a site depending on whether it is coming from the USA or elsewhere?

The reason I ask is because we have a worldwide webside and a USA website. When USA people attempt to view the worldwide website they should actually be taken to the USA website instead. Google does this depending on which country you are requesting the page from.

0
craigdev
Asked:
craigdev
3 Solutions
 
Harisha M GCommented:
Hi,

You need to check the IP address of the user. Typically this can be done using the server-side language like ASP, PHP etc.

---
Harish
0
 
craigdevAuthor Commented:
our CMS is php

What would you check the IP address against?
0
 
Harisha M GCommented:
craigdev, each country will have a set of numbers as the first/second octet of the IP address. You need to check whether that IP belongs to USA and redirect using header() if it doesn't.

$_SERVER['REMOTE_ADDR'] tells you the IP address of the user
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
AutogardCommented:
This is something that is quite difficult to do, even given the IP address, but you can get pretty close:

http://www.daniweb.com/techtalkforums/thread47999.html
http://www.hostip.info/
0
 
Eddie ShipmanAll-around developerCommented:
Those techniques don't always work because the user's ISP may also
have his IP range registered in another country.

Unless ICANN renumbers all IP addresses in ranges for specific countries, like
radio station call letters or airplane registration numbers, it isn't going to
be reliable.
0
 
AutogardCommented:
I agree, hence the "quite difficult to do" ... "but you can get pretty close".  :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now