IP Blocking
I just learned how to do this, and I'm so pleased with myself that I thought I would share for all.
A little backstory: I discovered the other day that my fiancee's ex (in the immortal words of Al Pacino, "a large-type asshole") had visited our wedding website. I decided to try to block any future access of his, and stumbled across this elegant solution.
Notice, this needs an Apache server to work:
Create a file in your site root called .htaccess and in it place the following code:
order allow,deny
deny from 192.168.44.201
deny from 224.39.163.12
deny from 172.16.7.92
allow from all
The example above shows how to block 3 different IP addresses. Sometimes you might want to block a whole range of IP addresses:
order allow,deny
deny from 192.168.
deny from 10.0.0.
allow from all
The above code will block any IP address starting with "192.168." or "10.0.0." from accessing your site.
Finally, here's the code to block any specific ISP from getting access:
order allow,deny
deny from some-evil-isp.com
deny from subdomain.another-evil-isp.com
allow from all
so I blocked his home ip address, his company ip address, and just for good measure, I blocked his entire ISP from accessing the site.
__________________
I am a brother to dragons, and a companion to owls.
- Job 30:29
1123, 6536, 5321
|