Tom Smykowski
Tom Smykowski

Reputation: 26089

How to allow IPS from range in htaccess?

I want users from 213.241.*.* IPS to access my blog admin section. When i add specific IP of my PC 213.241.34.24 it works. But when i set range it does not work.

I have tried:

order deny,allow
allow from 213.241.0
deny from all

and:

order deny,allow
allow from 213.241.*.*
deny from all

and

order deny,allow
allow from 213.241.
deny from all

and also:

order deny,allow
allow from 213.241.0.0 213.241.255.255
deny from all

and:

order deny,allow
allow from 213.241.0.0 - 213.241.255.255
deny from all

And it does not work.

I figured out this works:

order deny,allow
allow from 213.241.0.0/24
deny from all

But it allows only 213.241.0.* and therefore i would need to put a lots of rules like this to work it as i wish like:

order deny,allow
allow from 213.241.0.0/24
allow from 213.241.1.0/24
allow from 213.241.2.0/24
....
deny from all

Is there any easier way to allow 213.241.. IPS to access my blog admin section?

Upvotes: 0

Views: 177

Answers (1)

Jon Lin
Jon Lin

Reputation: 143886

If using the /24 CIDR works for you, why not just do /16?

order deny,allow
allow from 213.241.0.0/16
deny from all

Upvotes: 1

Related Questions