PDA

View Full Version : .htaccess blocking entire countries. HELP


Michel Samuel
12-24-2006, 08:16 PM
Hello everyone,

Sorry I couldn't have introduced myself before asking for help.
--------

Ok here is what I am trying to do and I admit that I am not a very smart person. So I ask for some patience in dealing with me.

I've got a couple of websites and I want to block a few countries from accessing them.

The first one I want to block is canada and France.
The second one I want to block is United States and the UK.

I've been searching and searching for relitive information. But sadly all the stuff I find pretty much only tells me what I already know. And I don't know where else to go with this.

All and any help is appreciated.


This is my current .htaccess file setup.

Order allow,deny
Deny from 66.11.48.0/20
Allow from all
#
Options +FollowSymlinks
RewriteEngine on
#
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://([^.]+\.)*mysite\.com [NC]
RewriteRule \.(gif夸pe?g如ng妃pe?g安mv地vi妃ov地sf存wf)$ - [NC,F]
#
RewriteCond %{HTTP_REFERER} alexa\.com [NC,OR]
RewriteCond %{HTTP_REFERER} example\.co\.uk [NC]
RewriteRule .* - [G]

felgall
12-24-2006, 08:30 PM
The only way I can think of to do it would be to obtain a list of all the IP ranges for the specific country that you want to block and specify all of them in the .htaccess

You would then need to keep track of when IP ranges are reallocated between countries. Also it would not stop someone going via an ISP or proxy in a different country to get around the block.

http://www.ip2location.com/ip-country-isp.aspx can provide you with the info on which IP addresses belong to which country.

Michel Samuel
12-24-2006, 09:11 PM
The only way I can think of to do it would be to obtain a list of all the IP ranges for the specific country that you want to block and specify all of them in the .htaccess

You would then need to keep track of when IP ranges are reallocated between countries. Also it would not stop someone going via an ISP or proxy in a different country to get around the block.

http://www.ip2location.com/ip-country-isp.aspx can provide you with the info on which IP addresses belong to which country.

I was hoping to find a cheaper approach to this...
I know as far as software goes 200 a year isn't too bad
but I'm probably never going to use it more than once and that makes it kind of steep.