mod_access_compat.html.en revision cc8190433d13f5e9de618c5d7f10c824c0c1919c
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<?xml version="1.0" encoding="ISO-8859-1"?>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
50c04f297d76a57ead2fa6b73845f7563b1fc788sf XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
50c04f297d76a57ead2fa6b73845f7563b1fc788sf This file is generated from xml source: DO NOT EDIT
50c04f297d76a57ead2fa6b73845f7563b1fc788sf XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
50c04f297d76a57ead2fa6b73845f7563b1fc788sf -->
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<title>mod_access_compat - Apache HTTP Server</title>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/images/favicon.ico" rel="shortcut icon" /></head>
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<body>
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<div id="page-header">
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<p class="apache">Apache HTTP Server Version 2.3</p>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<img alt="" src="/images/feather.gif" /></div>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<div id="path">
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Modules</a></div>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<div id="page-content">
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<div id="preamble"><h1>Apache Module mod_access_compat</h1>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<div class="toplang">
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<p><span>Available Languages: </span><a href="/en/mod/mod_access_compat.html" title="English">&nbsp;en&nbsp;</a> |
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<a href="/fr/mod/mod_access_compat.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a> |
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<a href="/ja/mod/mod_access_compat.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
053bfa8a288528fafab2b7a032c15116bb5de711nd</div>
053bfa8a288528fafab2b7a032c15116bb5de711nd<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Group authorizations based on host (name or IP
50c04f297d76a57ead2fa6b73845f7563b1fc788sfaddress)</td></tr>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>access_compat_module</td></tr>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_access_compat.c</td></tr>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3 as a compatibility module with
50c04f297d76a57ead2fa6b73845f7563b1fc788sfprevious versions of Apache 2.x. The directives provided by this module
50c04f297d76a57ead2fa6b73845f7563b1fc788sfhave been deprecated by the new authz refactoring. Please see
1538dfa9300693372892a358260e1dcdbf1138eapoirier<code class="module"><a href="/mod/mod_authz_host.html">mod_authz_host</a></code></td></tr></table>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<h3>Summary</h3>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic <p>The directives provided by <code class="module"><a href="/mod/mod_access_compat.html">mod_access_compat</a></code> are
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic used in <code class="directive"><a href="/mod/core.html#directory">&lt;Directory&gt;</a></code>,
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic <code class="directive"><a href="/mod/core.html#files">&lt;Files&gt;</a></code>, and
bed3c2e56e8f3328e780200466b9d009093db468sf <code class="directive"><a href="/mod/core.html#location">&lt;Location&gt;</a></code> sections
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic as well as <code><a href="core.html#accessfilename">.htaccess</a>
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic </code> files to control access to particular parts of the server.
50c04f297d76a57ead2fa6b73845f7563b1fc788sf Access can be controlled based on the client hostname, IP address, or
50c04f297d76a57ead2fa6b73845f7563b1fc788sf other characteristics of the client request, as captured in <a href="/env.html">environment variables</a>. The <code class="directive"><a href="#allow">Allow</a></code> and <code class="directive"><a href="#deny">Deny</a></code> directives are used to
50c04f297d76a57ead2fa6b73845f7563b1fc788sf specify which clients are or are not allowed access to the server,
50c04f297d76a57ead2fa6b73845f7563b1fc788sf while the <code class="directive"><a href="#order">Order</a></code>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf directive sets the default access state, and configures how the
50c04f297d76a57ead2fa6b73845f7563b1fc788sf <code class="directive"><a href="#allow">Allow</a></code> and <code class="directive"><a href="#deny">Deny</a></code> directives interact with each
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh other.</p>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf
50c04f297d76a57ead2fa6b73845f7563b1fc788sf <p>Both host-based access restrictions and password-based
50c04f297d76a57ead2fa6b73845f7563b1fc788sf authentication may be implemented simultaneously. In that case,
50c04f297d76a57ead2fa6b73845f7563b1fc788sf the <code class="directive"><a href="#satisfy">Satisfy</a></code> directive is used
bed3c2e56e8f3328e780200466b9d009093db468sf to determine how the two sets of restrictions interact.</p>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf
50c04f297d76a57ead2fa6b73845f7563b1fc788sf <div class="warning"><h3>Note</h3>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf <p>The directives provided by <code class="module"><a href="/mod/mod_access_compat.html">mod_access_compat</a></code> have
50c04f297d76a57ead2fa6b73845f7563b1fc788sf been deprecated by the new authz refactoring. Please see
50c04f297d76a57ead2fa6b73845f7563b1fc788sf <code class="module"><a href="/mod/mod_authz_host.html">mod_authz_host</a></code>.</p>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf </div>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf
50c04f297d76a57ead2fa6b73845f7563b1fc788sf <p>In general, access restriction directives apply to all
50c04f297d76a57ead2fa6b73845f7563b1fc788sf access methods (<code>GET</code>, <code>PUT</code>,
bed3c2e56e8f3328e780200466b9d009093db468sf <code>POST</code>, etc). This is the desired behavior in most
bed3c2e56e8f3328e780200466b9d009093db468sf cases. However, it is possible to restrict some methods, while
50c04f297d76a57ead2fa6b73845f7563b1fc788sf leaving other methods unrestricted, by enclosing the directives
50c04f297d76a57ead2fa6b73845f7563b1fc788sf in a <code class="directive"><a href="/mod/core.html#limit">&lt;Limit&gt;</a></code> section.</p>
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic</div>
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic<div id="quickview"><h3 class="directives">Directives</h3>
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic<ul id="toc">
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<li><img alt="" src="/images/down.gif" /> <a href="#allow">Allow</a></li>
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic<li><img alt="" src="/images/down.gif" /> <a href="#deny">Deny</a></li>
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic<li><img alt="" src="/images/down.gif" /> <a href="#order">Order</a></li>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<li><img alt="" src="/images/down.gif" /> <a href="#satisfy">Satisfy</a></li>
bed3c2e56e8f3328e780200466b9d009093db468sf</ul>
bed3c2e56e8f3328e780200466b9d009093db468sf<h3>See also</h3>
bed3c2e56e8f3328e780200466b9d009093db468sf<ul class="seealso">
bed3c2e56e8f3328e780200466b9d009093db468sf<li><code class="directive"><a href="/mod/mod_authz_core.html#require">Require</a></code></li>
bed3c2e56e8f3328e780200466b9d009093db468sf<li><code class="module"><a href="/mod/mod_authz_host.html">mod_authz_host</a></code></li>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<li><code class="module"><a href="/mod/mod_authz_core.html">mod_authz_core</a></code></li>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf</ul></div>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<div class="directive-section"><h2><a name="Allow" id="Allow">Allow</a> <a name="allow" id="allow">Directive</a></h2>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<table class="directive">
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls which hosts can access an area of the
053bfa8a288528fafab2b7a032c15116bb5de711ndserver</td></tr>
053bfa8a288528fafab2b7a032c15116bb5de711nd<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> Allow from all|<var>host</var>|env=[!]<var>env-variable</var>
727872d18412fc021f03969b8641810d8896820bhumbedooh[<var>host</var>|env=[!]<var>env-variable</var>] ...</code></td></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
727872d18412fc021f03969b8641810d8896820bhumbedooh<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Limit</td></tr>
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_access_compat</td></tr>
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh</table>
727872d18412fc021f03969b8641810d8896820bhumbedooh <p>The <code class="directive">Allow</code> directive affects which hosts can
0d0ba3a410038e179b695446bb149cce6264e0abnd access an area of the server. Access can be controlled by
0d0ba3a410038e179b695446bb149cce6264e0abnd hostname, IP address, IP address range, or by other
0d0ba3a410038e179b695446bb149cce6264e0abnd characteristics of the client request captured in environment
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh variables.</p>
0d0ba3a410038e179b695446bb149cce6264e0abnd
0d0ba3a410038e179b695446bb149cce6264e0abnd <p>The first argument to this directive is always
0d0ba3a410038e179b695446bb149cce6264e0abnd <code>from</code>. The subsequent arguments can take three
727872d18412fc021f03969b8641810d8896820bhumbedooh different forms. If <code>Allow from all</code> is specified, then
0d0ba3a410038e179b695446bb149cce6264e0abnd all hosts are allowed access, subject to the configuration of the
0d0ba3a410038e179b695446bb149cce6264e0abnd <code class="directive"><a href="#deny">Deny</a></code> and <code class="directive"><a href="#order">Order</a></code> directives as discussed
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh below. To allow only particular hosts or groups of hosts to access
1a1356f375e36db7bee379ea0684ab389579f798rbowen the server, the <em>host</em> can be specified in any of the
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen following formats:</p>
0d0ba3a410038e179b695446bb149cce6264e0abnd
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd <dl>
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd <dt>A (partial) domain-name</dt>
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd
50c04f297d76a57ead2fa6b73845f7563b1fc788sf <dd>
<div class="example"><h3>Example:</h3><p><code>
Allow from apache.org<br />
Allow from .net example.edu
</code></p></div>
<p>Hosts whose names match, or end in, this string are allowed
access. Only complete components are matched, so the above
example will match <code>foo.apache.org</code> but it will not
match <code>fooapache.org</code>. This configuration will cause
Apache to perform a double DNS lookup on the client IP
address, regardless of the setting of the <code class="directive"><a href="/mod/core.html#hostnamelookups">HostnameLookups</a></code> directive. It will do
a reverse DNS lookup on the IP address to find the associated
hostname, and then do a forward lookup on the hostname to assure
that it matches the original IP address. Only if the forward
and reverse DNS are consistent and the hostname matches will
access be allowed.</p></dd>
<dt>A full IP address</dt>
<dd>
<div class="example"><h3>Example:</h3><p><code>
Allow from 10.1.2.3<br />
Allow from 192.168.1.104 192.168.1.205
</code></p></div>
<p>An IP address of a host allowed access</p></dd>
<dt>A partial IP address</dt>
<dd>
<div class="example"><h3>Example:</h3><p><code>
Allow from 10.1<br />
Allow from 10 172.20 192.168.2
</code></p></div>
<p>The first 1 to 3 bytes of an IP address, for subnet
restriction.</p></dd>
<dt>A network/netmask pair</dt>
<dd>
<div class="example"><h3>Example:</h3><p><code>
Allow from 10.1.0.0/255.255.0.0
</code></p></div>
<p>A network a.b.c.d, and a netmask w.x.y.z. For more
fine-grained subnet restriction.</p></dd>
<dt>A network/nnn CIDR specification</dt>
<dd>
<div class="example"><h3>Example:</h3><p><code>
Allow from 10.1.0.0/16
</code></p></div>
<p>Similar to the previous case, except the netmask consists of
nnn high-order 1 bits.</p></dd>
</dl>
<p>Note that the last three examples above match exactly the
same set of hosts.</p>
<p>IPv6 addresses and IPv6 subnets can be specified as shown
below:</p>
<div class="example"><p><code>
Allow from 2001:db8::a00:20ff:fea7:ccea<br />
Allow from 2001:db8::a00:20ff:fea7:ccea/10
</code></p></div>
<p>The third format of the arguments to the
<code class="directive">Allow</code> directive allows access to the server
to be controlled based on the existence of an <a href="/env.html">environment variable</a>. When <code>Allow from
env=<var>env-variable</var></code> is specified, then the request is
allowed access if the environment variable <var>env-variable</var>
exists. When <code>Allow from env=!<var>env-variable</var></code> is
specified, then the request is allowed access if the environment
variable <var>env-variable</var> doesn't exist.
The server provides the ability to set environment
variables in a flexible way based on characteristics of the client
request using the directives provided by
<code class="module"><a href="/mod/mod_setenvif.html">mod_setenvif</a></code>. Therefore, this directive can be
used to allow access based on such factors as the clients
<code>User-Agent</code> (browser type), <code>Referer</code>, or
other HTTP request header fields.</p>
<div class="example"><h3>Example:</h3><p><code>
SetEnvIf User-Agent ^KnockKnock/2\.0 let_me_in<br />
&lt;Directory /docroot&gt;<br />
<span class="indent">
Order Deny,Allow<br />
Deny from all<br />
Allow from env=let_me_in<br />
</span>
&lt;/Directory&gt;
</code></p></div>
<p>In this case, browsers with a user-agent string beginning
with <code>KnockKnock/2.0</code> will be allowed access, and all
others will be denied.</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="Deny" id="Deny">Deny</a> <a name="deny" id="deny">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls which hosts are denied access to the
server</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> Deny from all|<var>host</var>|env=[!]<var>env-variable</var>
[<var>host</var>|env=[!]<var>env-variable</var>] ...</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Limit</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_access_compat</td></tr>
</table>
<p>This directive allows access to the server to be restricted
based on hostname, IP address, or environment variables. The
arguments for the <code class="directive">Deny</code> directive are
identical to the arguments for the <code class="directive"><a href="#allow">Allow</a></code> directive.</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="Order" id="Order">Order</a> <a name="order" id="order">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls the default access state and the order in which
<code class="directive">Allow</code> and <code class="directive">Deny</code> are
evaluated.</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> Order <var>ordering</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Order Deny,Allow</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Limit</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_access_compat</td></tr>
</table>
<p>The <code class="directive">Order</code> directive, along with the
<code class="directive"><a href="#allow">Allow</a></code> and
<code class="directive"><a href="#deny">Deny</a></code> directives,
controls a three-pass access control system. The first pass
processes either all <code class="directive"><a href="#allow">Allow</a></code> or all <code class="directive"><a href="#deny">Deny</a></code> directives, as specified
by the <code class="directive"><a href="#order">Order</a></code>
directive. The second pass parses the rest of the directives
(<code class="directive"><a href="#deny">Deny</a></code> or
<code class="directive"><a href="#allow">Allow</a></code>). The third
pass applies to all requests which do not match either of the first
two.</p>
<p>Note that all <code class="directive"><a href="#allow">Allow</a></code> and <code class="directive"><a href="#deny">Deny</a></code> directives are
processed, unlike a typical firewall, where only the first match is
used. The last match is effective (also unlike a typical firewall).
Additionally, the order in which lines appear in the configuration
files is not significant -- all <code class="directive"><a href="#allow">Allow</a></code> lines are processed as
one group, all <code class="directive"><a href="#deny">Deny</a></code> lines are considered as
another, and the default state is considered by itself.</p>
<p><em>Ordering</em> is one of:</p>
<dl>
<dt><code>Allow,Deny</code></dt>
<dd>First, all <code class="directive"><a href="#allow">Allow</a></code> directives are
evaluated; at least one must match, or the request is rejected.
Next, all <code class="directive"><a href="#deny">Deny</a></code>
directives are evaluated. If any matches, the request is rejected.
Last, any requests which do not match an <code class="directive"><a href="#allow">Allow</a></code> or a <code class="directive"><a href="#deny">Deny</a></code> directive are denied
by default.</dd>
<dt><code>Deny,Allow</code></dt>
<dd>First, all <code class="directive"><a href="#deny">Deny</a></code> directives are
evaluated; if any match, the request is denied
<strong>unless</strong> it also matches an <code class="directive"><a href="#allow">Allow</a></code> directive. Any
requests which do not match any <code class="directive"><a href="#allow">Allow</a></code> or <code class="directive"><a href="#deny">Deny</a></code> directives are
permitted.</dd>
<dt><code>Mutual-failure</code></dt>
<dd>This order has the same effect as <code>Order
Allow,Deny</code> and is deprecated in its favor.</dd>
</dl>
<p>Keywords may only be separated by a comma; <em>no whitespace</em>
is allowed between them.</p>
<table class="bordered">
<tr>
<th>Match</th>
<th>Allow,Deny result</th>
<th>Deny,Allow result</th>
</tr><tr>
<th>Match Allow only</th>
<td>Request allowed</td>
<td>Request allowed</td>
</tr><tr>
<th>Match Deny only</th>
<td>Request denied</td>
<td>Request denied</td>
</tr><tr>
<th>No match</th>
<td>Default to second directive: Denied</td>
<td>Default to second directive: Allowed</td>
</tr><tr>
<th>Match both Allow &amp; Deny</th>
<td>Final match controls: Denied</td>
<td>Final match controls: Allowed</td>
</tr>
</table>
<p>In the following example, all hosts in the apache.org domain
are allowed access; all other hosts are denied access.</p>
<div class="example"><p><code>
Order Deny,Allow<br />
Deny from all<br />
Allow from apache.org
</code></p></div>
<p>In the next example, all hosts in the apache.org domain are
allowed access, except for the hosts which are in the
foo.apache.org subdomain, who are denied access. All hosts not
in the apache.org domain are denied access because the default
state is to <code class="directive"><a href="#deny">Deny</a></code>
access to the server.</p>
<div class="example"><p><code>
Order Allow,Deny<br />
Allow from apache.org<br />
Deny from foo.apache.org
</code></p></div>
<p>On the other hand, if the <code class="directive">Order</code> in the
last example is changed to <code>Deny,Allow</code>, all hosts will
be allowed access. This happens because, regardless of the actual
ordering of the directives in the configuration file, the
<code>Allow from apache.org</code> will be evaluated last and will
override the <code>Deny from foo.apache.org</code>. All hosts not in
the <code>apache.org</code> domain will also be allowed access
because the default state is <code class="directive"><a href="#allow">Allow</a></code>.</p>
<p>The presence of an <code class="directive">Order</code> directive can
affect access to a part of the server even in the absence of
accompanying <code class="directive"><a href="#allow">Allow</a></code>
and <code class="directive"><a href="#deny">Deny</a></code>
directives because of its effect on the default access state. For
example,</p>
<div class="example"><p><code>
&lt;Directory /www&gt;<br />
<span class="indent">
Order Allow,Deny<br />
</span>
&lt;/Directory&gt;
</code></p></div>
<p>will Deny all access to the <code>/www</code> directory
because the default access state is set to
<code class="directive"><a href="#deny">Deny</a></code>.</p>
<p>The <code class="directive">Order</code> directive controls the order of access
directive processing only within each phase of the server's
configuration processing. This implies, for example, that an
<code class="directive"><a href="#allow">Allow</a></code> or <code class="directive"><a href="#deny">Deny</a></code> directive occurring in a
<code class="directive"><a href="/mod/core.html#location">&lt;Location&gt;</a></code> section will
always be evaluated after an <code class="directive"><a href="#allow">Allow</a></code> or <code class="directive"><a href="#deny">Deny</a></code> directive occurring in a
<code class="directive"><a href="/mod/core.html#directory">&lt;Directory&gt;</a></code> section or
<code>.htaccess</code> file, regardless of the setting of the
<code class="directive">Order</code> directive. For details on the merging
of configuration sections, see the documentation on <a href="/sections.html">How Directory, Location and Files sections
work</a>.</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="Satisfy" id="Satisfy">Satisfy</a> <a name="satisfy" id="satisfy">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Interaction between host-level access control and
user authentication</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Satisfy Any|All</code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Satisfy All</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_access_compat</td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Influenced by <code class="directive"><a href="/mod/core.html#limit">&lt;Limit&gt;</a></code> and <code class="directive"><a href="/mod/core.html#limitexcept">&lt;LimitExcept&gt;</a></code> in version 2.0.51 and
later</td></tr>
</table>
<p>Access policy if both <code class="directive"><a href="#allow">Allow</a></code> and <code class="directive"><a href="/mod/mod_authz_core.html#require">Require</a></code> used. The parameter can be
either <code>All</code> or <code>Any</code>. This directive is only
useful if access to a particular area is being restricted by both
username/password <em>and</em> client host address. In this case
the default behavior (<code>All</code>) is to require that the client
passes the address access restriction <em>and</em> enters a valid
username and password. With the <code>Any</code> option the client will be
granted access if they either pass the host restriction or enter a
valid username and password. This can be used to password restrict
an area, but to let clients from particular addresses in without
prompting for a password.</p>
<p>For example, if you wanted to let people on your network have
unrestricted access to a portion of your website, but require that
people outside of your network provide a password, you could use a
configuration similar to the following:</p>
<div class="example"><p><code>
Require valid-user<br />
Allow from 192.168.1<br />
Satisfy Any
</code></p></div>
<p>
Another frequent use of the <code class="directive">Satisfy</code> directive
is to relax access restrictions for a subdirectory:
</p>
<div class="example"><p><code>
&lt;Directory /var/www/private&gt;<br />
Require valid-user<br />
&lt;/Directory&gt;<br />
<br />
&lt;Directory /var/www/private/public&gt;<br />
Allow from all<br />
Satisfy Any<br />
&lt;/Directory&gt;
</code></p></div>
<p>In the above example, authentication will be required for the
<code>/var/www/private</code> directory, but will not be required
for the <code>/var/www/private/public</code> directory.</p>
<p>Since version 2.0.51 <code class="directive">Satisfy</code> directives can
be restricted to particular methods by <code class="directive"><a href="/mod/core.html#limit">&lt;Limit&gt;</a></code> and <code class="directive"><a href="/mod/core.html#limitexcept">&lt;LimitExcept&gt;</a></code> sections.</p>
<h3>See also</h3>
<ul>
<li><code class="directive"><a href="#allow">Allow</a></code></li>
<li><code class="directive"><a href="/mod/mod_authz_core.html#require">Require</a></code></li>
</ul>
</div>
</div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="/en/mod/mod_access_compat.html" title="English">&nbsp;en&nbsp;</a> |
<a href="/fr/mod/mod_access_compat.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a> |
<a href="/ja/mod/mod_access_compat.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>
</body></html>