What is the meaning of the "/" slash in such as the directive “allow from 000.111.222.333/444” in a .htaccess file?

475 Views Asked by At

For example, I have these directives in my .htaccess file:

<Limit GET HEAD POST>
order deny,allow
allow from 1.37.0.0/16
allow from 23.226.128.240/31
allow from 23.234.68.64/27
allow from 23.234.80.200/29
allow from 23.234.91.160/27
deny from all
</Limit>
  • What is the meaning of the "/" slashes therein?
  • And how can we convert them into mod_rewrite directives?
1

There are 1 best solutions below

3
mpontillo On

That value defines the number of bits to mask off the most significant bits in the address. See the Wikipedia page on CIDR for more details.

For example, if I specify 10.0.0.0/8, that means 10.* is allowed (or denied, whatever hte case may be). That's because each octet in an IPv4 address has 8 bits (1 byte, a.k.a. octet). If I specify 192.168.0.0/24, that masks off the first 24 bits (first 3 octets) and 192.168.0.* is allowed or denied.