Access control refers to any means of controlling access to any resource. This is separate from authentication and authorization.
If you wish to restrict access to portions of your site based on the
host address of your visitors, this is most easily done using
The
The usage of these directives is:
In the first form, address is a fully qualified domain name (or a partial domain name); you may provide multiple addresses or domain names, if desired.
In the second form, ip.address is an IP address, a partial IP address, a network/netmask pair, or a network/nnn CIDR specification. Either IPv4 or IPv6 addresses may be used.
For example, if you have someone spamming your message board, and you want to keep them out, you could do the following:
Visitors coming from that address will not be able to see the content covered by this directive. If, instead, you have a machine name, rather than an IP address, you can use that.
And, if you'd like to block access from an entire domain, you can specify just part of an address or domain name:
Use of the
Using the
Access control by User-Agent
is an unreliable technique,
since the User-Agent
header can be set to anything at all,
at the whim of the end user.
See the expressions document for a further discussion of what expression syntaxes and variables are available to you.
The [F]
For example, if you wish to block access to a resource between 8pm
and 6am, you can do this using
This will return a 403 Forbidden response for any request after 8pm or before 7am. This technique can be used for any criteria that you wish to check. You can also redirect, or otherwise rewrite these requests, if that approach is preferred.
You should also read the documentation for
See the Authentication and Authorization howto.