Forum Moderators: phranque

Message Too Old, No Replies

HTACCESS block IP range

         

JAB Creations

11:19 pm on May 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to block this range...
67.18.0.0 - 67.19.255.255

Now using those exact numbers and not getting dynamic or anything like the posts I keep seeing. I *just* want to be able to duplicate this multiple times (while understanding how to duplicate the code).

Now I've seen a post with this code...

RewriteCond %{REMOTE_ADDR} ^aaa\.bbb\.(23[2-9]�24[0-2])\. [OR]
RewriteCond %{REMOTE_ADDR} ^aaa\.bbb\.243\.([0-9]�[1-9][0-9]�1[0-4][0-9]�15[0-1])$
RewriteRule .* - [F]

where aaa and bbb are the first respectively second '***' from your range. Be sure to replace the broken pipe characters � with the real ones from your keyboard.

... but thats over my head and I just need something simple please! Once I get the simple stuff covered I'll get in to the dynamic stuff! :-D

sitz

11:31 pm on May 9, 2005 (gmt 0)

10+ Year Member



If all you want to do is block access from certain IPs, there are directives specifically for this:
Order [httpd.apache.org]
Allow [httpd.apache.org]
Deny [httpd.apache.org]

The Deny/Allow directives can deal with netmasks, which are infinitely superior than regular expressions' ability to deal with IP ranges. Additionally, you don't incur the processing overhead needed by mod_rewrite to execute Rules from a .htaccess file (details on this are in the mod_rewrite documentation [httpd.apache.org].

Of course, if you're simply wanting to learn how to write RewriteRules, that's fine. I'd suggest a different problem, however; The Right Tool For The Right Job(tm), and all that. =)

JAB Creations

7:39 am on May 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I read documentation and don't understand it due to my learning curve being too high for the lack of the understanding by those who make documentation to make thigns understandable in English.

*Bump*

JAB Creations

8:15 am on May 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Something I keep seeing is generalized IP range blocking. This is NOT what I want...

I want to specify the begining and ending IP addresses in FULL as non-abusive IPs will more then likely be on the near edge of abusive ranges.

JAB Creations

8:37 am on May 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's a guess but will this work?

<Limit GET HEAD POST>
order allow,deny
deny from 67.18.0.0-67.19.255.255
allow from all
</LIMIT>