Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirecting Users to (.ca) (.com) based on geographical address (IP) 1

Status
Not open for further replies.

animateyourart

Technical User
Jun 11, 2002
3
CA
I was wondering if anyone here can tell me how to write a script or tell me the process I would have to take in order to make this a reality:

I need to redirect users from USA/Canada by detecting their IP address, then giving them either the (.ca)website for Canada, (.com) website for USA.

If someone can help, they will be looked upon being an ultimate IP know it all. So many people I've contacted and nobody knows how to do it...Someone help!
 
Since there's no intrinsic geographic information stored in an IP address, you would need a gigantic "host"-type file with 4.16 billion entries (254^4) entries in it -- one for each possible "public" IP address. (And I know that due to vagarities in IP addressing, it's not really 254^4, but it's still a large-ish number)

Oh, and in about 30 years after your router is finally configured, you could go out for beers and celebrate.

 
you could trace the hops back and find the info on the servers that routed them to you. But that would be resource intensive and a huge pain.


you could just ask the user when he enters the page...
 
animateyourart,

First, let's start with what you are actually trying to accomplish. What you describe is very vague. There are numerous possibilities. Can you be more specific. Are you talking about users browsing to your site(s)? Do you want to redirect them to regional sites? Or areyou talking about geographically dispersed nodes on an enterprise network? The method will differ based on what your real objectives are.

From consumer.net:
How Can Users be Traced from their IP Addresses?

Once an IP address is captured several methods can be used to trace the user. These tools can be found at
[ul][li]Determine who owns the network. IP addresses are distributed in blocks to network providers or private companies. By searching IP registration databases it is possible to determine who owns an IP address block. Databases are available on the Internet for the Americas, Europe, and Asia-Pacific regions. Sophisticated computer break-ins sometimes include an attempt to erase the IP addresses captured by the log files to prevent this type of lookup. [/li]
[li]Perform a "reverse lookup." This converts the IP address into a computer name [Example: convert 206.156.18.122 into www.consumer.net]. This is used to determine if a computer is part of a registered Internet domain. [/li]
[li]Conduct a Traceroute. When information packets travel through the Internet they pass through several computers in a hierarchical fashion. Normally packets pass from the user to their Internet Service Provider (ISP) until it reaches the user's "backbone" provider. It then transfers to the destination "backbone " provider down to the ISP of the destination computer and finally to the intended recipient. It is often possible to determine an approximate physical location of an IP address in this fashion. It is also possible to determine the computer's ISP and/or network provider even if the computer itself is not part of a domain. This is usually how junk e-mail or "spam" is traced. [/li]
[li]Review domain registration information via the "WHOIS" databases. Domain registration information is available via the Internet by performing a WHOIS on the domain name portion of the computer name [Example: for perform WHOIS CONSUMER.NET to obtain the registration information]. [/li]
[li]Search the Internet for the IP address and/or computer name. It is often possible to find matches from users making public postings on discussion boards or from web sites that leave their log files open to the Internet. Of course, web site owners and/or banner networks could have additional non-public information based on activities at their web sites. [/li][/ul]

If you are talking about an enterprise network, you can exercise a greater level of control over the situation and embed information in environment variables, look at assigned servers and generally be creative with IP addressing. But somehow I suspect that is not where you are headed with this. Post back with some specifics.

The Old Man
 
I guess I could of been more clear in my question. So I guess you can say I want users to get regional websites based on their IP addresses. So If I was living in the USA and typed I wouldn't get .ca, I'd get the .com site. Just like Google.com. When I type google.com, I get google.ca, because I live in Canada.

Please help me. Thanx
 
I think Google uses the users client enviroment variables through ASP or PHP.
Very easy, really!
It doesn't have anything to do IP-adress of the client, it uses the users's regional settings to determine where he's brwosing from. I get google.be because my region is set to .be (belgium) ... check !!!
or send an email to google!!

greeetZ
 
Hello,

I don’t know how my idea will work out but if you have the financial resources you may want to contract to come up with a solution for you. When I visit their site they located my general whereabouts to about 20 miles within my home.

Maybe they can develop a custom solution for you,
possibly an if/else script for redirection based upon your defined variables.

Hope you tackle this interesting issue, let me know if you ever develop a low-cost solution for this issue. I would like to experiment with it myself. _______________________________________
mysig_small1.gif

Brian Velkavrh
Sr. Consultant - BPV Webdesigns
Network+ Certified Engineer
bpvlogo.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top