NameSilo

How to redirect my visitors depending on where they come from (UK or USA)

SpaceshipSpaceship
Watch

Ash

Established Member
Impact
0
Hi,
How do i make it so that when someone goes to: www.nintendoshop.net

If they are from the UK, they get redirected to uk.nintendoshop.net and if they are from anywhere else in the world (such as the usa) they get redirected to nintendoshop.net

Does anyone know how to do this? (The best/easiest way)

Thanks.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains — AI StorefrontUnstoppable Domains — AI Storefront
as far as i know, the only way to do it would be by tracing their ip, like sourceforge does when you download

this might not be reliable, as ips can be spoofed.

the other way is by asking the user then placing a cookie with their info on their pc.
 
0
•••
Ah good idea, that might be even better... but do you know how to do it?

If anyone knows a GOOD way to do it and they can do it for me (cheap) i don't mind paying them...
 
0
•••
which method?
select your shop? ill have a go at it for you.
 
0
•••
There's many ways really - .... but none are foolproof.

PHP:
<?php
	$locales = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
	if ( $locales == "" ) {
$gouri = 'http://nintendoshop.net/';
	} else {
	$semicolon = array(";");
	$lesssemicolon = str_replace($semicolon, ",", "$locales");
	$breakdown = explode(",",$lesssemicolon);
	$lang_count = strtolower("$breakdown[0]");
	}
	if ( $lang_count == "en-uk" ) {
$gouri = 'http://uk.nintendoshop.net/';
}	else	{
$gouri = 'http://nintendoshop.net/';
	}
header("Location: $gouri");
?>

This of course only works for language specific visitors of the UK ;)

en-uk visitor (Only those with their "main locale" set on their browser to English/United Kingdom) would go to "uk.nintendoshop.net" - All others will go to "nintendoshop.net" .... (Whether they have a locale set or not).


Just a different way to approach it ;)

Remember though !
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.
 
0
•••
If you don't need it to happen automatically, you can do what UPS and other places do. Go to ups.com to see what I mean. I can do that for you, just PM me.
 
0
•••
0
•••
Thanks for the help - im still not 100% sure what kind of redirect i want... so just a quick question:

If i use a simple redirection code (like the php code in a few posts above me) where will a search engine bot go? Will the search engine bot also be redirected or...?
 
0
•••
Sometimes the search engine will follow. Sometimes it will say "screw this".
 
0
•••
If you build it - They will come !
 
0
•••
Ash said:
Thanks for the help - im still not 100% sure what kind of redirect i want... so just a quick question:

If i use a simple redirection code (like the php code in a few posts above me) where will a search engine bot go? Will the search engine bot also be redirected or...?

It depends on the way the bot is programmed.
If you use the above PHP method, it will follow as a header that the site is moved will be sent.
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Zero Commission
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back