The authorization providers implemented by .htaccess
files to control access to particular parts of the server.
Access can be controlled based on the client hostname or IP address.
In general, access restriction directives apply to all
access methods (GET
, PUT
,
POST
, etc). This is the desired behavior in most
cases. However, it is possible to restrict some methods, while
leaving other methods unrestricted, by enclosing the directives
in a
Apache's ip
and host
.
Other authorization types may also be
used but may require that additional authorization modules be loaded.
These authorization providers affect which hosts can access an area of the server. Access can be controlled by hostname, IP Address, or IP Address range.
The ip
provider allows access to the server
to be controlled based on the IP address of the remote client.
When Require ip ip-address
is specified,
then the request is allowed access if the IP address matches.
A full IP address:
An IP address of a host allowed access
A partial IP address:
The first 1 to 3 bytes of an IP address, for subnet restriction.
A network/netmask pair:
A network a.b.c.d, and a netmask w.x.y.z. For more fine-grained subnet restriction.
A network/nnn CIDR specification:
Similar to the previous case, except the netmask consists of nnn high-order 1 bits.
Note that the last three examples above match exactly the same set of hosts.
IPv6 addresses and IPv6 subnets can be specified as shown below:
The host
provider allows access to the server
to be controlled based on the host name of the remote client.
When Require host host-name
is specified,
then the request is allowed access if the host name matches.
A (partial) domain-name
Hosts whose names match, or end in, this string are allowed
access. Only complete components are matched, so the above
example will match foo.example.org
but it will not
match fooexample.org
. This configuration will cause
Apache to perform a double reverse DNS lookup on the client IP
address, regardless of the setting of the
The local
provider allows access to the server if any
of the following conditions is true:
This allows a convenient way to match connections that originate from the local host: