/    Sign up×
Community /Pin to ProfileBookmark

IP Address Web Redirection

does anyone here know how to redirect users from a webpage to another site depending on their global location?

By that i mean if for example, theres a website called [url]www.company.com[/url] so a client from UK will be redirected to the [url]www.company.co.uk[/url] website and similarly a client in Australia will be redirected to [url]www.company.au[/url].

I think that each country has a range of ip addresses and depending on that specific range, they should be redirected to that webpage.

Could some point me in right direction?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@hyperliskApr 24.2006 — You can't get the IP from JavaScript. You need a Server Side language like PHP to do that. From PHP, you could get the IP with
[code=php]
$ip = $_SERVER['REMOTE_ADDR'];
[/code]
Copy linkTweet thisAlerts:
@scoperApr 24.2006 — you could use the HTTP_ACCEPT_LANGUAGE server variable to determin their language and redirect based on that... it might be easier than checking ip address lists

Scott
×

Success!

Help @vampiro spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...