From: Rich Bowen
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
+ host address of your visitors, use
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
@@ -80,12 +82,29 @@ Require ip ip.address
partial IP address, a network/netmask pair, or a network/nnn CIDR
specification. Either IPv4 or IPv6 addresses may be used. See the
mod_authz_host documentation for further examples of this
syntax. You can insert Visitors coming from that address ( And, if you'd like to block access from an entire domain,
- you can specify just part of an address or domain name:not to negate a particular requirement.
- Note, that since a not is a negation of a value, it cannot
+ Since a not is a negation of a value, it cannot
be used by itself to allow or deny a request, as not true
does not constitute false. Thus, to deny a visit using a negation,
the block must have one element that evaluates as true or false.
@@ -93,30 +112,36 @@ Require ip ip.address
board, and you want to keep them out, you could do the
following:10.252.46.165)
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.
Use of the Using the Access control by For example, if you wish to block access to a resource between 8pm
and 7am, 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
expr syntax, this could also be written as:User-Agent is an unreliable technique,
@@ -170,12 +199,14 @@ Require expr %{HTTP_USER_AGENT} != 'BadBot'