This seems to be quite easy to accomplish with .htaccess. To block someone from a specific IP address add the following to a .htaccess file: (or append it to an existing one, taking care not to delete important existing rules)
RewriteEngine On RewriteCond %{REMOTE_ADDR} ^195\.171\.111\.196 RewriteRule .* http://goaway.coopey.me [R,L]
If you wanted to block a whole range of IP addresses use '.$' e.g. to block the range 195.171.111.* use the following for line two:
RewriteCond %{REMOTE_ADDR} ^195\.171\.111\.$
If you wanted to block a subsection, use the following format: (this will block 195.171.111.16 to 195.171.111.32)
RewriteCond %{REMOTE_ADDR} ^195\.171\.111\.(1[6-9]|2[0-9]|3[0-2])$
The IP address 195.171.111.196 in this example seems to be A4e's fixed IP from their head office in Sheffield. The page goaway.coopey.me is hosted at Tumblr, and says 'Access Denied' with a short explanation why.
Remember, this will only work on visitors from a specific IP (or range of IPs). If you block a range, you may be blocking more people than you attended, and if you block someone who uses a dynamic IP address (their ISP changes this each time they connect to the internet) then they will not be permanently redirected- and the people who are subsequently assigned the IP will have to access!
No comments:
Post a Comment