Forum Moderators: phranque
To block the range 100.101.128.0 - 100.101.255.255 can be used something like this:
RewriteCond %{REMOTE_ADDR} ^100\.101\.(12[89]¦1[3-9][0-9]¦2[0-4][0-9]¦25[0-5])\.*$
I would like to know if it's possible to write that condition more simple, like:
RewriteCond %{REMOTE_ADDR} ^(100.101.[128-255].*)$
The above condition gives an Error 500. Can someone explain why?
Thank you,
xt
A correction is needed, and you can shorten the regex slightly:
RewriteCond %{REMOTE_ADDR} ^100\.101\.(12[89]¦1[3-9][0-9]¦2[0-5][0-9])\.
This actually allows 100.101.250-259\.0-255, but since you'll never get a request for an octet value above 255, it doesn't matter and saves a few characters. There is also no need to specify the final octet, since it won't matter either.
Jim
But I don't understand something. For blocking the range 100.101.0.0 - 100.101.112.255, the condition below works perfectly:
RewriteCond %{REMOTE_ADDR} ^(100.101.[0-112].*)$ [OR]
If I change it for the range 100.101.128.0 - 100.101.255.255 I receive an Error 500. Isn't that weird?
Also, please, can you show me the RewriteCond for the range 100.252.0.0 - 100.255.255.255?
Thanks,
xt