Welcome to WebmasterWorld Guest from 54.226.133.245

Forum Moderators: phranque

Message Too Old, No Replies

301 redirect from specific countries?

301 redirect

     
7:51 am on Sep 15, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


Is it possible to use a 301 redirect for specific countries only?

For example, when mysite.com is clicked in Germany, it redirects to the new site.

However when mysite.com is clicked in the UK, it goes to the original site

Is that possible at all?
2:32 pm on Sept 15, 2010 (gmt 0)

Senior Member from KZ 

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 10, 2005
posts: 2886
votes: 1


You can achieve this if your site is based on a scripting language like PHP. With every page request your scripts first check the IP address of the visitor. Based on the country associated with that IP address a 301 header is generated, or the regular content of the page is displayed.

You don't need to maintain a list of IP address and country associations yourself. There are paid and free IP databases available which you can use from within your scripts. You should know that these databases are not 100% accurate so you may now and then redirect visitors erroneously. Also frequent updating of the database is necessary because new IP address blocks are handed out on a continuous base.
2:39 pm on Sept 15, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


Ok great thanks. Can you tell me of the services that supply these databases?
2:49 pm on Sept 15, 2010 (gmt 0)

Senior Member from KZ 

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 10, 2005
posts: 2886
votes: 1


There are several services. You can find them with Bing or Google with search terms like country ip database.
3:01 pm on Sept 15, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


great thanks mate
10:04 am on Sept 16, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


I am wondering, is it possible to do the following:

When a person in Dubai search for a word, mysite.com shows No.1 in the SERPS, when that person clicks the link it redirects to mysite2.com

So what I am thinking, is that the redirect picks up the location from where the link has come from i.e. someone in dubai.

Is that possible?
2:32 pm on Sept 20, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


bump
10:05 pm on Sept 20, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


you can certainly redirect based on referer (HTTP_REFERER), such as www.google.ae, or based on an IP (REMOTE_ADDR) of a visitor which location is known.
for the latter you will need to use an IP geolocation database.
7:45 am on Sept 21, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


ok great. I think the referer would work better. I will look into this. Any tips on where to look?
7:50 am on Sept 21, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


what server platform are you using?
8:04 am on Sept 21, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


linux
8:34 am on Sept 21, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


apache?
8:39 am on Sept 21, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


sorry yes
8:53 am on Sept 21, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


the RewriteCond directive would be similar to those used for the Access Restriction example for robots:
http://httpd.apache.org/docs/2.0/rewrite/rewrite_guide.html#access [httpd.apache.org]

for the RewriteRule directive, here is the full mod_rewrite doc for Apache 2.0:
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html [httpd.apache.org]

any specific redirect questions should be posted in the Apache Web Server [webmasterworld.com] forum.
9:01 am on Sept 21, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


thank you very much for your time. I appreciate the help
9:02 am on Sept 21, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


Quick question, I am correct in thinking this will still tell Google that the site has moved and help with SERPS. The old site ranks high and I want to pass that onto the new site
1:58 pm on Sept 21, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


in general, if you treat the crawler in the same way as you treat the search-referred visitor, you'll probably be ok.
however you should be aware that any time you are cloaking you are playing with fire, so you need to know precisely what you are doing, why and how.
2:03 pm on Sept 21, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


Its basically I am closing one site down and dont want to lose any traffic. I own both sites
2:18 pm on Sept 21, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


your question in the OP and the question i answered indicated a form of location-based cloaking.
2:27 pm on Sept 21, 2010 (gmt 0)

New User

5+ Year Member

joined:July 15, 2010
posts: 22
votes: 0


I dont know what clocking is mate. Not sure what you mean
10:46 pm on Sept 21, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


Cloaking [webmasterworld.com]