I want to allow IP range in .htaccess

I want to resolve all IP addresses between 145.050.039.008 and 145.050.039.017 inclusive

For example (but this does not work):

 allow from 145.050.039.008 145.050.039.017 

or

 allow from 145.050.039.008,145.050.039.017 

or

 allow from 145.050.039.008/017 

?

Thanks Jelmar

+8
.htaccess
source share
1 answer
 A̶l̶l̶o̶w̶ ̶f̶r̶o̶m̶ ̶1̶4̶5̶.̶0̶5̶0̶.̶0̶3̶9̶.̶0̶0̶8̶ ̶1̶4̶5̶.̶0̶5̶0̶.̶0̶3̶9̶.̶0̶1̶7̶ 

C̶h̶e̶c̶k̶ ̶ h̶e̶r̶e̶ ̶f̶o̶r̶ ̶d̶e̶t̶a̶i̶l̶s̶.̶


(later) EDIT:

My bad, my previous answer never worked, at that time I answered without understanding the problem.

Option # 1: determine all IP

Here is the only way to do this:

 Allow from 145.50.39.8 Allow from 145.50.39.9 Allow from 145.50.39.10 Allow from 145.50.39.11 Allow from 145.50.39.12 Allow from 145.50.39.13 Allow from 145.50.39.14 Allow from 145.50.39.15 Allow from 145.50.39.16 Allow from 145.50.39.17 

Option # 2: use partial IP

If you need something more general, you can use partial IP:

 Allow from 145.50.39 

But this will allow IP from 145.50.39.0 to 145.50.39.255 .

Option # 3: use a netmask or CIDR

To get closer, you can use a netmask or CIDR:

 Allow from 145.50.39.0/255.255.255.224 

or

 Allow from 145.50.39.0/27 

This will allow IP from 145.50.39.0 to 145.50.39.31 .

+14
source share

All Articles