Page is a not externally linkable
- Hardware and OS Related Technologies
-- Website Technology Issues
---- How to block a country from accessing my website?


rocknbil - 9:42 pm on Oct 27, 2007 (gmt 0)


If you have an Apache server, you can do this without scripting. Scripting will still allow them to poke around your site. Additionally you'd have to do it on all files, and change it every time a new one comes up.

This is a little complex, things can go wrong, so fully research before you drop in an .htaccess file with deny directives. Once you are familiar it, it as simple as creating a plain text file containing something like this, and naming it ".htaccess." "#" are comments and will not affect the functioning of the directives.

order allow,deny
<Limit GET POST>
allow from all

# specific IP address
deny from 123.123.123.123
# deny a range: 123.123.0.0 - 123.123.255.255
deny from 123.123.0.0/16
# the whole class: 123.0.0.0 - 123.255.255.255
deny from 123.0.0.0/8
# shorthand for previous
deny from 123
</Limit>


Thread source:: http://www.webmasterworld.com/website_technology/3474186.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com