Allow Access to Multiple IPs with CIDR Notation

#1
Hi,
I have a htaccess rewrite to block all IPs apart from 1 to a certain file like so:
Code:
<IfModule mod_rewrite.c>
RewriteCond %{REMOTE_ADDR} !^123\.243\.16\.228
RewriteRule xmlrpc - [F,L]
</IfModule>
I want to add multiple IPs, so I would use additional RewrireCond lines but how to add IP addresses with CIDR notation like so:

192.0.112.0/20
195.234.108.0/22

I tried:
Code:
RewriteCond expr "-R '192.0.112.0/20'"
RewriteCond expr "-R '195.234.108.0/22'"
But it fails.

Any ideas
Thanks
 

Cold-Egg

Administrator
#2
How about this,
Code:
RewriteCond %{REMOTE_ADDR} !^192\.0\.[112-127]\.[0-255]
RewriteCond %{REMOTE_ADDR} !^195\.234\.[108-111]\.[0-255]
 
Top