Solved

Redirect USA traffic away from a website

Posted on 2006-06-26
6
247 Views
Last Modified: 2012-06-21
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
Comment
Question by:craigdev
6 Comments
 
LVL 37

Expert Comment

by:Harisha M G
ID: 16988503
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
 
LVL 1

Author Comment

by:craigdev
ID: 16988529
our CMS is php

What would you check the IP address against?
0
 
LVL 37

Assisted Solution

by:Harisha M G
Harisha M G earned 150 total points
ID: 16988562
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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 8

Assisted Solution

by:Autogard
Autogard earned 150 total points
ID: 16988648
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
 
LVL 26

Accepted Solution

by:
EddieShipman earned 200 total points
ID: 17009864
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
 
LVL 8

Expert Comment

by:Autogard
ID: 17009894
I agree, hence the "quite difficult to do" ... "but you can get pretty close".  :)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question