FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How to redirect user based on user country?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How to redirect user based on user country? [message #175638 is a reply to message #175630] Fri, 14 October 2011 09:53 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 10/13/2011 11:00 PM, justaguy wrote:
> Hi,
>
> I wonder how we can accomplish this task?
> Say, a user from India lands at http://www.knowledgenotebook.com/download.html
> (actually it would be http://www.knowledgenotebook.com/download.php )
> I'd like to direct this visitor to http://bla.bla.bla.bla.in/download.html
>
> And if the user is from China
> it would be redirected to http://bla.bla.bla.bla.cn/download.html
> so and so forth.
>
> This approach would be more elegant if easily doable. If so how?
>
> Though another approach is also doable, messy.
> Download mirror site in India
> Download mirror site in China
> ...
>
> Thanks.
>
>

You can't do it reliably. You can only go by the user's ip address
using one of the geoip databases around.

But these databases have limited accuracy. They depend on the user's ip
address being in the same country as the user (which may or may not be
correct, especially for dial-up users and those using a proxy).
Additionally, they depend on an ISP not allocating ip addresses across
multiple countries.

Additionally, just because a server is in the same country doesn't mean
it's necessarily the best server to use. There are many reasons a
server in another country would be better.

A better way is to display a list of servers and let the user choose.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: including CSS & JS on only pages that need that CSS & JS
Next Topic: Can I stop sending content-length header?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 20:26:22 GMT 2024

Total time taken to generate the page: 0.03715 seconds