Naumov
Naumov

Reputation: 1167

How to set rewrite cond apache by Ip range

I have this rewrite cond in .htaccess

RewriteCond %{REMOTE_ADDR} !^195.16.40.50

How to set RewriteCond by ip range from 192.168.0.0 to 192.168.32.255

Upvotes: 2

Views: 258

Answers (1)

Florian Lemaitre
Florian Lemaitre

Reputation: 5748

This condition should match your ip range:

RewriteCond %{REMOTE_ADDR} ^195\.168\.([0-9]|[1-2][0-9]|3[0-2])\.[0-9]+$

Upvotes: 2

Related Questions