cancel
Showing results for 
Search instead for 
Did you mean: 

IP-blocking - to block whole IP-areas of Spammers in .htaccess

ffupi
Grafter
Posts: 370
Registered: ‎01-08-2007

IP-blocking - to block whole IP-areas of Spammers in .htaccess

Hello
Got the impression that some people in e.g. China sit the whole day on their computer and manually spammed my forum. I had cut out the spam-bots with captcha integration into my forum, so that had stopped.
So, I put on the very begin of my .htaccess file in root of ccgi, before the rewrite conditions I have already in the .htaccess file, the following:
<Files *>
order deny,allow
deny from 000.000.000.000
deny from 000.000.000.000/001
deny from 000.000.
deny from domain.tld
</Files>
Got this from here: http://www.webmasterworld.com/forum92/413-3-30.htm
(Thread entry of 2:07 am on Mar. 17, 2004).
The first line blocks one IP-address. In my case this address is all over in forums with juicy entries.
The second line blocks a range of IP-addresses ending 000 to 001.
The third line blocks a whole area of IP-addresses, so the whole of China could be blocked I guess.
The last line blocks a domain.
Any comments?
3 REPLIES
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: IP-blocking - to block whole IP-areas of Spammers in .htaccess

2 things....
1) .htaccess will not protect .php files no matter what you put in it. So PHP based forums cannot be protected
2) What you have given has been tried and does not work! Most likely because PN don't allow that kind of entry within .htaccess.
ffupi
Grafter
Posts: 370
Registered: ‎01-08-2007

Re: IP-blocking - to block whole IP-areas of Spammers in .htaccess

OK, two more questions:
Would that work:
<Limit GET PUT POST>
order deny,allow
deny from 000.00.00.00
</Limit>
Huh
Or, I could just redirect the IP:
RewriteCond %{REMOTE_ADDR} ^000.000.000.000
RewriteCond %{HTTP_HOST} !^$
RewriteRule /* http://www.goaway.com/ [R,L]
(From here: http://www.hostvector.com/support/index.php?x=&mod_id=2&root=17&id=99)
That should work.
MikeWhitehead
Grafter
Posts: 748
Registered: ‎19-08-2007

Re: IP-blocking - to block whole IP-areas of Spammers in .htaccess

Quote from: ffupi

deny from 000.000.000.000/001
The second line blocks a range of IP-addresses ending 000 to 001.
The third line blocks a whole area of IP-addresses, so the whole of China could be blocked I guess.

Just a quick note (I may be picking you up wrong), but why are you using 001 for the slash notation? if You wanted to block (e.g.) 201.92.89.1, then shouldn't you simply declare that as a deny on its own? Slash notation defines the subnet which should be denied, not a deny range between the two.