Forum Moderators: phranque

Message Too Old, No Replies

htaccess, block ip address

htaccess block ip

         

cyberdyne

8:08 pm on Nov 30, 2009 (gmt 0)

10+ Year Member



Hi,
I've been getting a lot of unwanted traffic on one site from a specific web host who I've contacted to report the 'abuse' but have had no response from. I've also tried to sign up to their forum but my registration was never confirmed.

Therefore, I wish to use htaccess to block the offending IP's but cannot work out how to format a one-line Rewrite Cond. for multiple IP's.

eg: RewriteCond %{REMOTE_ADDR} !^173\.45\.

(I wish to block 173.45.64.0 - 173.45.127.255)

Any help greatly appreciated.
Many thanks.

cyberdyne

8:31 pm on Nov 30, 2009 (gmt 0)

10+ Year Member



It's just dawned on me that I could simply use 'Deny from'.

Is there any difference between using 'Deny from' and 'RewriteCond&{' ?

Thank you

wilderness

8:56 pm on Nov 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you may use the CIDR for the 64-127 range:
deny from 173.45.64.0/18

Is there any difference between using 'Deny from' and 'RewriteCond&{' ?

RewriteCond offers more versatility and efficiency in strings, making it possible to reduce the overall number of lines in your htaccess. (if your just beginning the process of denying visitors, than making your file compact is not something that requires immediate attention.)

cyberdyne

9:11 pm on Nov 30, 2009 (gmt 0)

10+ Year Member



Thank you wilderness