[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 12-31-2006, 06:10 PM   #1 (permalink)
Ash
NamePros Regular
 
Join Date: Mar 2006
Location: UK
Posts: 204
62.10 NP$ (Donate)

Ash is an unknown quantity at this point


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

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.
Ash is offline  
Old 12-31-2006, 06:14 PM   #2 (permalink)
NamePros Regular
 
Alex.'s Avatar
 
Join Date: Nov 2006
Location: Uk
Posts: 601
133.80 NP$ (Donate)

Alex. is on a distinguished road

Ethan Allen Fund Third World Education
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.
__________________
_\|/_ _\|/_ _\|/_ _\|/_ _\|/_ :confused:
Alex. is offline  
Old 12-31-2006, 06:42 PM   #3 (permalink)
Ash
NamePros Regular
 
Join Date: Mar 2006
Location: UK
Posts: 204
62.10 NP$ (Donate)

Ash is an unknown quantity at this point


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...
Ash is offline  
Old 12-31-2006, 06:56 PM   #4 (permalink)
NamePros Regular
 
Alex.'s Avatar
 
Join Date: Nov 2006
Location: Uk
Posts: 601
133.80 NP$ (Donate)

Alex. is on a distinguished road

Ethan Allen Fund Third World Education
which method?
select your shop? ill have a go at it for you.
__________________
_\|/_ _\|/_ _\|/_ _\|/_ _\|/_ :confused:
Alex. is offline  
Old 12-31-2006, 07:11 PM   #5 (permalink)
No Country for Old Domainers ...

Member Services

 
Mark's Avatar
 
Join Date: Mar 2004
Posts: 9,874
4,750.95 NP$ (Donate)

Mark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond repute

Ethan Allen Fund
There's many ways really - .... but none are foolproof.

PHP Code:

<?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 !
Quote:
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.
Mark is offline  
Old 12-31-2006, 07:43 PM   #6 (permalink)
Senior Member
 
RegisterRants's Avatar
 
Join Date: Oct 2006
Posts: 1,144
257.37 NP$ (Donate)

RegisterRants has a spectacular aura aboutRegisterRants has a spectacular aura aboutRegisterRants has a spectacular aura about


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.
__________________
Web Development
RegisterRants is offline  
Old 12-31-2006, 07:49 PM   #7 (permalink)
NamePros Regular
 
Join Date: Feb 2006
Posts: 588
1,620.95 NP$ (Donate)

jerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to all


You can use the Geo-IP Database (for a price).

Their database is very comprehensive with many ISPs listed.

LINK : http://www.maxmind.com/app/country
jerometan is offline  
Old 12-31-2006, 09:29 PM   #8 (permalink)
Ash
NamePros Regular
 
Join Date: Mar 2006
Location: UK
Posts: 204
62.10 NP$ (Donate)

Ash is an unknown quantity at this point


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...?
Ash is offline  
Old 12-31-2006, 09:32 PM   #9 (permalink)
Senior Member
 
RegisterRants's Avatar
 
Join Date: Oct 2006
Posts: 1,144
257.37 NP$ (Donate)

RegisterRants has a spectacular aura aboutRegisterRants has a spectacular aura aboutRegisterRants has a spectacular aura about


Sometimes the search engine will follow. Sometimes it will say "screw this".
__________________
Web Development
RegisterRants is offline  
Old 12-31-2006, 10:05 PM   #10 (permalink)
No Country for Old Domainers ...

Member Services

 
Mark's Avatar
 
Join Date: Mar 2004
Posts: 9,874
4,750.95 NP$ (Donate)

Mark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond reputeMark has a reputation beyond repute

Ethan Allen Fund
If you build it - They will come !
Mark is offline  
Old 01-01-2007, 02:03 AM   #11 (permalink)
NamePros Regular
 
Join Date: Feb 2006
Posts: 588
1,620.95 NP$ (Donate)

jerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to all


Quote:
Originally Posted by Ash
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.
jerometan is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 07:38 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85