Welcome to WebmasterWorld Guest from 54.226.27.104

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Allowing a few countries access, but redirecting all others

     

Dexie

1:06 pm on Jun 7, 2011 (gmt 0)

10+ Year Member



Seem to be getting really stuck on this and could do with some help from some of you experts if you could please? Is there any way of allowing just a few countries access, (USA, Mexico and Canada), and redirecting all other countries to another website please?

Must be 100% accurate, or at least 95%. Minimal load on the server. Free would be nice, but could pay 10-15 usd a month, if it was worth it.

The hosts have given me the info below, in case it's of any help.

The following Perl modules are installed on the server:
Geo::IP 1.39
Geo::IPfree 1.110450
Geography::Countries 2009041301
Installed Net_GeoIP PEAR module.

The file path to the module is :
/opt/geoip/share/GeoIP/GeoIP.dat

Any help much appreciated.

Dexie

Leosghost

1:10 pm on Jun 7, 2011 (gmt 0)

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



Using your favorite SE ..search for "geo ip redirect" or "geo ip block" or "geo ip ban" ..and there have been loads of threads here in the past on this ..some relatively recent.

Dexie

1:14 pm on Jun 7, 2011 (gmt 0)

10+ Year Member



Many thanks Leosghost - have done that, but wondered if any of the members here had any hands on experience of any way of doing this.

Leosghost

1:20 pm on Jun 7, 2011 (gmt 0)

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



The only one you will find with the accuracy you want is at maxmind..and is not the free one.

Dexie

1:20 pm on Jun 7, 2011 (gmt 0)

10+ Year Member



Just a thought, but is there any way of doing this, but redirecting other countries to another page on the same website?

Leosghost

1:22 pm on Jun 7, 2011 (gmt 0)

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



Yes..there are various ways ..not all involving htaccess ..

Dexie

1:56 pm on Jun 7, 2011 (gmt 0)

10+ Year Member



What are the various ways please?

Leosghost

2:05 pm on Jun 7, 2011 (gmt 0)

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



If you go to the site I mentioned above you will see various scripts ready made for perl, php, javascript etc.

I'm not linking to the page as it is a commercial site and TOS here restricts that.

Personally I use a custom made system because I require it to do more ( and more accurately ) than what is available ..even there.

Dexie

2:14 pm on Jun 7, 2011 (gmt 0)

10+ Year Member



Thanks, I was trying for free first, if possible. Which way are you doing yours please? PHP, HTaccess ?

Dexie

3:52 pm on Jun 7, 2011 (gmt 0)

10+ Year Member



Really trying to solve this. Just tried :

GeoIPEnable On
GeoIPDBFile /opt/geoip/share/GeoIP/GeoIP.dat
RewriteEngine On
#
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(US|KR|CN|BR)$
RewriteRule ^(.*)$ http://www.google.com/ [R,L]


But, getting a 500 internal server error?

Anyone see anyhting wrong with that code please?

Dexie

wilderness

6:23 pm on Jun 7, 2011 (gmt 0)

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



Seem to be getting really stuck on this and could do with some help from some of you experts if you could please? Is there any way of allowing just a few countries access, (USA, Mexico and Canada), and redirecting all other countries to another website please?


see "You want Class A's [webmasterworld.com]

Dexie

9:18 am on Jun 14, 2011 (gmt 0)

10+ Year Member



Thanks wilderness, have been all through that thread and can't seem to find anything to help in this particular scenario? Also, if it's relevant, I'm on a shared server.

wilderness

12:38 pm on Jun 14, 2011 (gmt 0)

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



either create "deny from"'s for each range or "SetEnvIf Remote_Addr" or "RewriteCond %{REMOTE_ADDR}".

The Class A's I provided will exclude the majority of non- US and Canada IP's.

FWIW, I've used shared hosting since 1999.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month