See: <a href="ssl/">SSL/TLS Encryption</a>
</dd>
+ <dt><a name="perdirectory" id="perdirectory">Per-directory Context</a></dt>
+ <dd>A <a class="glossarylink" href="./glossary.html#directive" title="see glossary">directive</a> is in
+ per-directory context when it appears in a <code class="directive"><a href="./mod/core.html#directory"><Directory></a></code>, <code class="directive"><a href="./mod/core.html#directorymatch"><DirectoryMatch></a></code>, <code class="directive"><a href="./mod/core.html#files"><Files></a></code>, or <code class="directive"><a href="./mod/core.html#filesmatch"><FilesMatch></a></code> section in the main
+ configuration files, or in a <code>.htaccess</code> file.
+ In per-directory context, directives apply only to the
+ directory (or set of files) they are associated with.<br />
+ See: <a href="sections.html">Configuration Sections</a>
+ </dd>
+
<dt><a name="plaintext" id="plaintext">Plaintext</a></dt>
<dd>The unencrypted text.</dd>
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.de.xsl"?>
-<!-- English Revision: 420990:1933506 (outdated) -->
+<!-- English Revision: 420990:1933655 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml-stylesheet type="text/xsl" href="./style/manual.fr.xsl"?>
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
-<!-- English Revision: 1933086:1933506 (outdated) -->
+<!-- English Revision: 1933086:1933655 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.ja.xsl"?>
-<!-- English Revision: 664361:1933506 (outdated) -->
+<!-- English Revision: 664361:1933655 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version="1.0" encoding="EUC-KR" ?>
<!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.ko.xsl"?>
-<!-- English Revision: 105989:1933506 (outdated) -->
+<!-- English Revision: 105989:1933655 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="./style/manual.tr.xsl"?>
-<!-- English Revision: 1174747:1933506 (outdated) -->
+<!-- English Revision: 1174747:1933655 (outdated) -->
<!-- =====================================================
Translated by: Nilgün Belma Bugüner <nilgun belgeler.org>
Reviewed by: Orhan Berent <berent belgeler.org>
without causing any log message, the additional information is not logged
either.</p>
- <p>It can happen that some format string items do not produce output. For
+ <p>It can happen that some format specifiers do not produce output. For
example, the Referer header is only present if the log message is
associated to a request and the log message happens at a time when the
Referer header has already been read from the client. If no output is
produced, the default behavior is to delete everything from the preceding
- space character to the next space character. This means the log line is
+ space character to the next space character. This means the format string is
implicitly divided into fields on non-whitespace to whitespace transitions.
- If a format string item does not produce output, the whole field is
+ If a format specifier does not produce output, the whole field is
omitted. For example, if the remote address <code>%a</code> in the log
format <code>[%t] [%l] [%a] %M </code> is not available, the surrounding
brackets are not logged either. Space characters can be escaped with a
</tr>
</table>
- <p>Some format string items accept additional parameters in braces.</p>
+ <p>Some format specifiers accept additional parameters in braces.</p>
<table class="bordered"><tr class="header"><th>Format String</th> <th>Description</th></tr>
<tr><td><code>%%</code></td>
The server will follow symbolic links in this directory. This is
the default setting.
<div class="note">
+ <p>Disabling this option also prevents
+ <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> from operating in per-directory
+ context (<code>.htaccess</code> files and <code class="directive"><a href="#directory"><Directory></a></code> sections).</p>
<p>Even though the server follows the symlink it does <em>not</em>
change the pathname used to match against <code class="directive"><a href="#directory"><Directory></a></code> sections.</p>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr>
</table>
<p>The <code class="directive">ServerPath</code> directive sets the legacy
- URL pathname for a host, for use with <a href="../vhosts/">name-based virtual hosts</a>.</p>
+ URL pathname for a host, for use with <a href="../vhosts/name-based.html">name-based virtual hosts</a>.</p>
+
+ <div class="note"><p>This is a legacy feature for providing compatibility with
+ HTTP/1.0 clients that do not send a <code>Host:</code> header. When
+ such a client requests a URL matching a vhost's
+ <code class="directive">ServerPath</code>, the request is served from that
+ vhost. In practice, all modern HTTP clients send the
+ <code>Host:</code> header, making this directive unnecessary.</p></div>
<h3>See also</h3>
<ul>
-<li><a href="../vhosts/">Apache HTTP Server Virtual Host documentation</a></li>
+<li><a href="../vhosts/name-based.html">Name-based Virtual Host Support</a></li>
+<li><a href="../vhosts/examples.html#serverpath">ServerPath example</a></li>
</ul>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.de.xsl"?>
-<!-- English Revision: 344972:1933590 (outdated) -->
+<!-- English Revision: 344972:1933666 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.es.xsl"?>
-<!-- English Revision: 1741251:1933590 (outdated) -->
+<!-- English Revision: 1741251:1933666 (outdated) -->
<!-- Translated by Luis Gil de Bernabé Pfeiffer lgilbernabe[AT]apache.org -->
<!-- Reviewed by Sergio Ramos-->
<!--
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1932811:1933590 (outdated) -->
+<!-- English Revision: 1932811:1933666 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
-<!-- English Revision: 669847:1933590 (outdated) -->
+<!-- English Revision: 669847:1933666 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.tr.xsl"?>
-<!-- English Revision: 1302855:1933590 (outdated) -->
+<!-- English Revision: 1302855:1933666 (outdated) -->
<!-- =====================================================
Translated by: Nilgün Belma Bugüner <nilgun belgeler.org>
Reviewed by: Orhan Berent <berent belgeler.org>
Alias "/secure" "/webpages/secure"
<Directory "/webpages/secure">
- Require all granted
-
- AuthBasicProvider file
-
AuthType Basic
- AuthName LDAP_Protected_Place
+ AuthName "LDAP Protected"
+ AuthBasicProvider ldap
+ AuthLDAPUrl "ldap://ldap.host/o=ctx"
#implied OR operation
Require ldap-group-alias1
<p><span>Langues Disponibles: </span><a href="../en/mod/mod_authz_core.html" hreflang="en" rel="alternate" title="English"> en </a> |
<a href="../fr/mod/mod_authz_core.html" title="Français"> fr </a></p>
</div>
+<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
+ anglaise pour les changements récents.</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Socle d'autorisation</td></tr>
<tr><th><a href="module-dict.html#Status">Statut:</a></th><td>Base</td></tr>
<tr><th><a href="module-dict.html#ModuleIdentifier">Identificateur de Module:</a></th><td>authz_core_module</td></tr>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision:1888002 -->
+<!-- English Revision: 1888002:1933649 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
<variants>
<variant>en</variant>
- <variant>fr</variant>
+ <variant outdated="yes">fr</variant>
</variants>
</metafile>
from being escaped.</div>
<p>When used inside a <code class="directive"><a href="../mod/core.html#location"><Location></a></code> section, the first argument is omitted and the local
- directory is obtained from the <code class="directive"><a href="../mod/core.html#location"><Location></a></code>. The same will occur inside a
+ directory is obtained from the <code class="directive"><a href="../mod/core.html#location"><Location></a></code>. When used outside a <code class="directive"><a href="../mod/core.html#location"><Location></a></code> or <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code> section, the
+ <var>path</var> argument is required. The same will occur inside a
<code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code> section;
however, ProxyPass does not interpret the regexp as such, so it is necessary
to use <code class="directive">ProxyPassMatch</code> in this situation instead.</p>
to reverse-proxy a subdirectory.</p>
<p>When used inside a <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code> section, the first argument is omitted and the
- regexp is obtained from the <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code>.</p>
+ regexp is obtained from the <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code>. When used outside a <code class="directive"><a href="../mod/core.html#location"><Location></a></code> or <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code> section, the
+ <var>regex</var> argument is required.</p>
<p>If you require a more flexible reverse-proxy configuration, see the
<code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directive with the
URL.</p>
<p>When used inside a <code class="directive"><a href="../mod/core.html#location"><Location></a></code> section, the first argument is omitted and the local
- directory is obtained from the <code class="directive"><a href="../mod/core.html#location"><Location></a></code>. The same occurs inside a <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code> section, but will probably not work as
+ directory is obtained from the <code class="directive"><a href="../mod/core.html#location"><Location></a></code>. When used outside a <code class="directive"><a href="../mod/core.html#location"><Location></a></code> or <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code> section, the
+ <var>path</var> argument is required. The same occurs inside a <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code> section, but will probably not work as
intended, as ProxyPassReverse will interpret the regexp literally as a
path; if needed in this situation, specify the ProxyPassReverse outside
the section or in a separate <code class="directive"><a href="../mod/core.html#location"><Location></a></code> section.</p>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1932769:1933602 (outdated) -->
+<!-- English Revision: 1932769:1933645 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
-<!-- English Revision: 344971:1933602 (outdated) -->
+<!-- English Revision: 344971:1933645 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
URL after the hostname and port, and before the query string (e.g. "/app1/index.html").
This is the (%-decoded) <a href="directive-dict.html#Syntax">URL-path</a>.</p></li>
- <li><p>In per-directory context (<code class="directive"><a href="../mod/core.html#directory">Directory</a></code> and .htaccess),
+ <li><p>In <a class="glossarylink" href="../glossary.html#perdirectory" title="see glossary">per-directory context</a>
+ (<code class="directive"><a href="../mod/core.html#directory">Directory</a></code> and .htaccess),
the <em>Pattern</em> is matched against only a partial path, for example a request
of "/app1/index.html" may result in comparison against "app1/index.html"
or "index.html" depending on the directory-path for which the
</ul>
</div>
-<div class="note"><h3>Per-directory Rewrites</h3>
+<div class="note"><h3><a class="glossarylink" href="../glossary.html#perdirectory" title="see glossary">Per-directory</a> Rewrites</h3>
<ul>
<li>The rewrite engine may be used in <a href="../howto/htaccess.html">.htaccess</a> files and in <code class="directive"><a href="../mod/core.html#directory"><Directory></a></code> sections, with some additional
complexity.</li>
<li>To enable the rewrite engine in this context, you need to set
"<code>RewriteEngine On</code>" <strong>and</strong>
-"<code>Options FollowSymLinks</code>" must be enabled. If your
-administrator has disabled override of <code>FollowSymLinks</code> for
-a user's directory, then you cannot use the rewrite engine. This
-restriction is required for security reasons.</li>
+the <code>FollowSymLinks</code> or <code>SymLinksIfOwnerMatch</code>
+<code class="directive"><a href="../mod/core.html#options">Options</a></code> must be enabled. If your
+administrator has disabled override of these options for a user's
+directory via <code class="directive"><a href="../mod/core.html#allowoverride">AllowOverride</a></code>, the
+rewrite engine cannot be used in <code>.htaccess</code> files in that
+directory.</li>
<li>See the <code class="directive"><a href="#rewritebase">RewriteBase</a></code>
directive for more information regarding what prefix will be added back to
you specify a <em>Substitution</em> string of
<code>/www/file.html</code>, then this will be treated as a
URL-path <em>unless</em> a directory named <code>www</code>
- exists at the root or your file-system (or, in the case of
- using rewrites in a <code>.htaccess</code> file, relative to
+ exists at the root of your file-system (or, in the case of
+ per-directory rewrites, relative to
your document root), in which case it will
be treated as a file-system path. If you wish other
URL-mapping directives (such as <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>) to be applied to the
<p>Back-references are identifiers of the form
<code>$</code><strong>N</strong>
- (<strong>N</strong>=0..9), which will be replaced
- by the contents of the <strong>N</strong>th group of the
- matched <em>Pattern</em>. The server-variables are the same
+ (<strong>N</strong>=0..9). <code>$0</code> refers to the
+ entire string matched by the <em>Pattern</em>, while
+ <code>$1</code>..<code>$9</code> refer to the corresponding
+ captured groups from the matched <em>Pattern</em>. The server-variables are the same
as for the <em>TestString</em> of a
<code class="directive"><a href="#rewritecond">RewriteCond</a></code>
directive. The mapping-functions come from the
<tr>
<td>last|L</td>
<td>Stop the rewriting process immediately and don't apply any
- more rules. Especially note caveats for per-directory and
- .htaccess context (see also the END flag). <em><a href="../rewrite/flags.html#flag_l">details ...</a></em></td>
+ more rules. Especially note caveats for per-directory context (see also the END flag). <em><a href="../rewrite/flags.html#flag_l">details ...</a></em></td>
</tr>
<tr class="odd">
<td>next|N</td>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1932387:1933562 (outdated) -->
+<!-- English Revision: 1932387:1933662 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
<div class="section">
<h2><a name="authzproviders" id="authzproviders">Authorization providers for use with Require</a> <a title="Permanent link" href="#authzproviders" class="permalink">¶</a></h2>
- <p><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> provides a few authentication providers for use
- with <code class="module"><a href="../mod/mod_authz_core.html">mod_authz_core</a></code>'s
+ <p><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> provides the following authorization providers
+ for use with <code class="module"><a href="../mod/mod_authz_core.html">mod_authz_core</a></code>'s
<code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code> directive.</p>
<h3><a name="reqssl" id="reqssl">Require ssl</a></h3>
<p>The <code>ssl</code> provider denies access if a connection is not
- encrypted with SSL. This is similar to the
- <code class="directive">SSLRequireSSL</code> directive.</p>
+ encrypted with SSL. Unlike the
+ <code class="directive">SSLRequireSSL</code> directive, this can be
+ combined with other <code class="directive">Require</code> directives in
+ <code class="directive"><a href="../mod/mod_authz_core.html#requireany">RequireAny</a></code> or
+ <code class="directive"><a href="../mod/mod_authz_core.html#requireall">RequireAll</a></code> blocks.</p>
<pre class="prettyprint lang-config">Require ssl</pre>
<h3><a name="reqverifyclient" id="reqverifyclient">Require ssl-verify-client</a></h3>
- <p>The <code>ssl</code> provider allows access if the user is
- authenticated with a valid client certificate. This is only
+ <p>The <code>ssl-verify-client</code> provider allows access if the
+ user is authenticated with a valid client certificate. This is only
useful if <code>SSLVerifyClient optional</code> is in effect.</p>
<p>The following example grants access if the user is authenticated
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.es.xsl"?>
-<!-- English Revision: 1817381:1933555 (outdated) -->
+<!-- English Revision: 1817381:1933647 (outdated) -->
<!-- Spanish Translation: Daniel Ferradal <dferradal@apache.org> -->
<!-- Updated and reviewed: Luis Gil de bernabe <lgilbernabe@apache.org> -->
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1933097:1933555 (outdated) -->
+<!-- English Revision: 1933097:1933647 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
<code>25</code> (<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>). Therefore, to increase <code class="directive">MaxRequestWorkers</code> to a value that requires more than 16 processes,
you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
+ <p>For threaded and hybrid MPMs, <code class="directive">MaxRequestWorkers</code>
+ must be at least as large as
+ <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>, and
+ should be an integer multiple of
+ <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>. If it
+ is not a multiple, the server will round it down to the nearest
+ multiple at startup and log a warning.</p>
+
+ <div class="example"><h3>Warning: MaxRequestWorkers too small</h3><p><code>
+ WARNING: MaxRequestWorkers of 10 is less than ThreadsPerChild
+ of 25, increasing to 25. MaxRequestWorkers must be at least as
+ large as the number of threads in a single server.
+ </code></p></div>
+
+ <div class="example"><h3>Warning: MaxRequestWorkers not a multiple of ThreadsPerChild</h3><p><code>
+ WARNING: MaxRequestWorkers of 90 is not an integer multiple of
+ ThreadsPerChild of 25, decreasing to nearest multiple 75, for a
+ maximum of 3 servers.
+ </code></p></div>
+
<p><code class="directive">MaxRequestWorkers</code> was called
<code class="directive">MaxClients</code> before version 2.3.13. The old name is still
supported.</p>
least 1. Values less than 1 will be automatically increased to 1
and a warning will be logged.</p>
+ <p>The value of <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code>
+ must be an integer multiple of <code class="directive">ThreadsPerChild</code>.
+ See <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> for
+ details.</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="ThreadStackSize" id="ThreadStackSize">ThreadStackSize</a> <a name="threadstacksize" id="threadstacksize">Directive</a> <a title="Permanent link" href="#threadstacksize" class="permalink">¶</a></h2>
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.de.xsl"?>
-<!-- English Revision: 151408:1933599 (outdated) -->
+<!-- English Revision: 151408:1933657 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1933179:1933599 (outdated) -->
+<!-- English Revision: 1933179:1933657 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
-<!-- English Revision: 674934:1933599 (outdated) -->
+<!-- English Revision: 674934:1933657 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.tr.xsl"?>
-<!-- English Revision: 1308409:1933599 (outdated) -->
+<!-- English Revision: 1308409:1933657 (outdated) -->
<!-- =====================================================
Translated by: Nilgün Belma Bugüner <nilgun belgeler.org>
Reviewed by: Orhan Berent <berent belgeler.org>
<p>One case where <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>
is genuinely useful for proxying is when you want to proxy requests only
-for content that doesn't exist locally — for example, during a migration
+for content that doesn't exist locally - for example, during a migration
from one server to another:</p>
<pre class="prettyprint lang-config">RewriteCond "%{REQUEST_FILENAME}" !-f
<dt>Discussion:</dt>
<dd>
- <p>If you need more complex logic — such as serving an
- alternate image to hotlinkers instead of denying the request — you
+ <p>If you need more complex logic - such as serving an
+ alternate image to hotlinkers instead of denying the request - you
may need <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. The following examples
rely on the <code>HTTP_REFERER</code> header, which is optional
and can be spoofed. The <code>!^$</code> condition allows
<p>Use <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>, which provides a
flexible and featureful load-balancing solution. It supports
several balancing algorithms, session stickiness, health checks,
- and dynamic configuration via the Balancer Manager — none of which
+ and dynamic configuration via the Balancer Manager - none of which
are possible with a <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> approach.</p>
<pre class="prettyprint lang-config"><Proxy "balancer://mycluster">
<p>One case where <directive module="mod_rewrite">RewriteRule</directive>
is genuinely useful for proxying is when you want to proxy requests only
-for content that doesn't exist locally — for example, during a migration
+for content that doesn't exist locally - for example, during a migration
from one server to another:</p>
<highlight language="config">
<dt>Discussion:</dt>
<dd>
- <p>If you need more complex logic — such as serving an
- alternate image to hotlinkers instead of denying the request — you
+ <p>If you need more complex logic - such as serving an
+ alternate image to hotlinkers instead of denying the request - you
may need <module>mod_rewrite</module>. The following examples
rely on the <code>HTTP_REFERER</code> header, which is optional
and can be spoofed. The <code>!^$</code> condition allows
<p>Use <module>mod_proxy_balancer</module>, which provides a
flexible and featureful load-balancing solution. It supports
several balancing algorithms, session stickiness, health checks,
- and dynamic configuration via the Balancer Manager — none of which
+ and dynamic configuration via the Balancer Manager - none of which
are possible with a <module>mod_rewrite</module> approach.</p>
<highlight language="config">
<a href="../tr/rewrite/htaccess.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a> |
<a href="../zh-cn/rewrite/htaccess.html" hreflang="zh-cn" rel="alternate" title="Simplified Chinese"> zh-cn </a></p>
</div>
+<div class="outofdate">Diese Übersetzung ist möglicherweise
+ nicht mehr aktuell. Bitte prüfen Sie die englische Version auf
+ die neuesten Änderungen.</div>
<p>Dieses Dokument ergänzt die <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
</div>
-<p>This document supplements the <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
-<a href="../mod/mod_rewrite.html">reference documentation</a>. It describes
-the way that the rules change when you use <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> in .htaccess files,
-and how to deal with these changes.</p>
+<p>Using <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> in <code>.htaccess</code> files
+is one of the most common - and most confusing -
+<a class="glossarylink" href="../glossary.html#perdirectory" title="see glossary">per-directory</a> configurations.
+This document explains the key differences between using rewrite
+rules in server configuration versus <code>.htaccess</code> files,
+and provides practical guidance for avoiding the most common pitfalls.</p>
+
+<p>For the low-level technical details of how <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
+processes rules in per-directory context, see the
+<a href="tech.html#InternalAPI">Technical Details</a> document.</p>
</div>
-<div id="quickview"><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li><li><a href="remapping.html">Redirection and remapping</a></li><li><a href="vhosts.html">Virtual hosts</a></li><li><a href="proxy.html">Proxying</a></li><li><a href="rewritemap.html">Using RewriteMap</a></li><li><a href="advanced.html">Advanced techniques</a></li><li><a href="avoid.html">When not to use mod_rewrite</a></li><li><a href="#comments_section">Comments</a></li></ul></div>
-</div>
+<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#prerequisites">Prerequisites: AllowOverride</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#path-stripping">What URL does the rule see?</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#rewritebase">When you need RewriteBase</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#loops">The [L] flag and looping</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#rewritemap-restriction">RewriteMap cannot be
+declared in .htaccess</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#inheritance">Rule inheritance with RewriteOptions</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#debugging">Debugging .htaccess rewrite rules</a></li>
+</ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li><li><a href="remapping.html">Redirection and remapping</a></li><li><a href="vhosts.html">Virtual hosts</a></li><li><a href="rewritemap.html">Using RewriteMap</a></li><li><a href="avoid.html">When not to use mod_rewrite</a></li><li><a href="flags.html">RewriteRule Flags</a></li><li><a href="tech.html">Technical details</a></li><li><a href="#comments_section">Comments</a></li></ul></div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="prerequisites" id="prerequisites">Prerequisites: AllowOverride</a> <a title="Permanent link" href="#prerequisites" class="permalink">¶</a></h2>
+
+<p>Before <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> directives in a
+<code>.htaccess</code> file will be processed at all, the server
+configuration must permit them. This requires:</p>
+
+<pre class="prettyprint lang-config"><Directory "/var/www/htdocs">
+ AllowOverride FileInfo
+</Directory></pre>
+
+
+<p>Without at least <code>AllowOverride FileInfo</code> (or
+<code>AllowOverride All</code>), any <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
+directives in <code>.htaccess</code> files are silently ignored.
+If your rules don't appear to be doing anything, this is the first
+thing to check.</p>
+
+<p>Additionally, either <code>Options FollowSymLinks</code> or
+<code>Options SymLinksIfOwnerMatch</code> must be enabled for the
+directory in question. Because a
+<code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> can map a URL
+to an arbitrary filesystem path - functionally equivalent to a symbolic
+link - <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> refuses to operate in per-directory
+context unless one of these options is set. Without it, you will see
+the following error:</p>
+
+<div class="example"><p><code>
+AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off,
+so the RewriteRule directive is also forbidden due to its similar
+ability to circumvent directory restrictions
+</code></p></div>
+
+<p>This restriction applies to both <code>.htaccess</code> files and
+<code class="directive"><a href="../mod/core.html#directory"><Directory></a></code> blocks.</p>
+
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="path-stripping" id="path-stripping">What URL does the rule see?</a> <a title="Permanent link" href="#path-stripping" class="permalink">¶</a></h2>
+
+<p>In server or virtualhost context, the
+<code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> pattern is
+matched against the full URL-path, starting with a leading slash.
+In <code>.htaccess</code> context, the directory prefix is
+<strong>stripped</strong>.</p>
+
+<p>For example, if your <code>.htaccess</code> is in
+<code>/var/www/htdocs/app/</code> and a request comes in for
+<code>/app/products/widget</code>, the RewriteRule sees only
+<code>products/widget</code> - no leading slash, no
+<code>/app/</code> prefix.</p>
+
+<p>This means you must write your patterns differently depending on
+where the rule lives:</p>
+
+ <table class="bordered">
+ <tr>
+ <th>Location of rule</th>
+ <th>Rule</th>
+ </tr>
+ <tr>
+ <td>VirtualHost section</td>
+ <td><code>RewriteRule "^/app/products/(.+)$" "/app/shop.php?item=$1"</code></td>
+ </tr>
+ <tr>
+ <td>.htaccess in /var/www/htdocs/app/</td>
+ <td><code>RewriteRule "^products/(.+)$" "shop.php?item=$1"</code></td>
+ </tr>
+ </table>
+
+<p>Note that the <code>.htaccess</code> version has no leading slash
+in either the pattern or the substitution. This is the single most
+common source of confusion with per-directory rewriting.</p>
+
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="rewritebase" id="rewritebase">When you need RewriteBase</a> <a title="Permanent link" href="#rewritebase" class="permalink">¶</a></h2>
+
+<p>When <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> makes a substitution in
+<code>.htaccess</code> context, it needs to turn the relative result
+back into a full URL-path. The
+<code class="directive"><a href="../mod/mod_rewrite.html#rewritebase">RewriteBase</a></code> directive tells
+it what prefix to prepend.</p>
+
+<p>By default, <code class="directive"><a href="../mod/mod_rewrite.html#rewritebase">RewriteBase</a></code>
+is set to the physical directory path of the <code>.htaccess</code>
+file. In most cases, this does the right thing, and you don't need
+to set it explicitly. But there are situations where you do:</p>
+
+<ul>
+<li><strong>Alias or symlink:</strong> If the directory is reached via
+an <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code> or a symlink, the
+URL path and the filesystem path differ, and
+<code class="directive"><a href="../mod/mod_rewrite.html#rewritebase">RewriteBase</a></code> must be set
+to the URL path.</li>
+
+<li><strong>Subdirectory applications:</strong> A common pattern for
+PHP frameworks is to place a <code>.htaccess</code> in a subdirectory
+(say, <code>/var/www/htdocs/myapp/</code>) and route all requests to
+a front controller:</li>
+</ul>
+
+<pre class="prettyprint lang-config"># In /var/www/htdocs/myapp/.htaccess
+RewriteEngine On
+RewriteBase "/myapp/"
+RewriteCond "%{REQUEST_FILENAME}" !-f
+RewriteCond "%{REQUEST_FILENAME}" !-d
+RewriteRule "^(.*)$" "index.php" [L]</pre>
+
+
+<div class="note">For this particular use case - routing all unmatched
+requests to a front controller - the
+<a href="remapping.html#fallback-resource">FallbackResource</a> directive
+is a simpler and more efficient alternative to mod_rewrite.</div>
+
+<p>Without the <code>RewriteBase "/myapp/"</code> line, the rewritten
+URL might resolve incorrectly, because <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
+would prepend the filesystem path rather than the URL path.</p>
+
+<p>If you're using absolute URLs (starting with <code>/</code> or
+<code>http://</code>) in your substitutions,
+<code class="directive"><a href="../mod/mod_rewrite.html#rewritebase">RewriteBase</a></code> has no effect
+- it only applies to relative substitutions.</p>
+
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="loops" id="loops">The [L] flag and looping</a> <a title="Permanent link" href="#loops" class="permalink">¶</a></h2>
+
+<p>In server context, the <code>[L]</code> flag means "stop processing
+the ruleset." In <code>.htaccess</code> context, it means something
+subtly different: "stop processing the ruleset <em>for this pass</em>."
+After the substitution is made, Apache re-processes the request from
+the top - including re-applying the <code>.htaccess</code> rules.
+This can lead to infinite loops.</p>
+
+<p>Consider this rule:</p>
+
+<pre class="prettyprint lang-config"># In .htaccess - this may loop!
+RewriteRule "^(.*)$" "/index.php?q=$1" [L]</pre>
+
+
+<p>On the first pass, a request for <code>/hello</code> is rewritten to
+<code>/index.php?q=hello</code>. Then the request is re-processed, and
+now <code>index.php</code> matches <code>^(.*)$</code> again, rewriting
+to <code>/index.php?q=index.php</code>. This continues until Apache
+hits its internal redirect limit and returns a 500 error. You will see
+the following in the error log:</p>
+
+<div class="example"><p><code>
+AH00124: Request exceeded the limit of 10 internal redirects due to
+probable configuration error. Use 'LimitInternalRecursion' to increase
+the limit if necessary. Use 'LogLevel debug' to get a backtrace.
+</code></p></div>
+
+<p>There are several ways to break the loop:</p>
+
+<p><strong>Option 1: Use the [END] flag</strong> (recommended)</p>
+
+<pre class="prettyprint lang-config">RewriteRule "^(.*)$" "/index.php?q=$1" [END]</pre>
+
+
+<p>The <code>[END]</code> flag (available since Apache 2.3.9) stops
+<em>all</em> further rewrite processing, including subsequent passes.
+It is the cleanest way to prevent loops.</p>
+
+<p><strong>Option 2: Add a condition to skip already-rewritten URLs</strong></p>
+
+<pre class="prettyprint lang-config">RewriteCond "%{REQUEST_FILENAME}" !-f
+RewriteCond "%{REQUEST_FILENAME}" !-d
+RewriteRule "^(.*)$" "/index.php?q=$1" [L]</pre>
+
+
+<p>Since <code>index.php</code> exists as a file, the
+<code>!-f</code> condition causes the rule to be skipped on the second
+pass.</p>
+
+<p><strong>Option 3: Check THE_REQUEST</strong></p>
+
+<pre class="prettyprint lang-config">RewriteCond "%{THE_REQUEST}" "!index\.php"
+RewriteRule "^(.*)$" "/index.php?q=$1" [L]</pre>
+
+
+<p>The <code>%{THE_REQUEST}</code> variable contains the original
+request line as sent by the client, which is not modified by
+<code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. Checking it prevents the rule from
+matching rewritten URLs.</p>
+
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="rewritemap-restriction" id="rewritemap-restriction">RewriteMap cannot be
+declared in .htaccess</a> <a title="Permanent link" href="#rewritemap-restriction" class="permalink">¶</a></h2>
+
+<p>The <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code> directive
+can only be declared in server or virtualhost context - not in
+<code>.htaccess</code> files or
+<code class="directive"><a href="../mod/core.html#directory"><Directory></a></code> blocks.
+However, once a map is declared in the server configuration, you
+<em>can</em> use it from a <code>.htaccess</code> file:</p>
+
+<pre class="prettyprint lang-config"># In httpd.conf or a VirtualHost
+RewriteMap product2id "txt:/etc/apache2/productmap.txt"</pre>
+
+
+<pre class="prettyprint lang-config"># In .htaccess - using the map declared above
+RewriteEngine On
+RewriteRule "^product/(.+)$" "/prods.php?id=${product2id:$1|NOTFOUND}" [PT]</pre>
+
+
+<p>This restriction exists because <code>.htaccess</code> files are
+parsed on every request, and map initialization (especially for
+<code>dbm:</code>, <code>dbd:</code>, and <code>prg:</code> map types)
+would be prohibitively expensive to repeat each time.</p>
+
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="inheritance" id="inheritance">Rule inheritance with RewriteOptions</a> <a title="Permanent link" href="#inheritance" class="permalink">¶</a></h2>
+
+<p>By default, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> rules are <strong>not
+inherited</strong> by subdirectories. If you define rules in
+<code>/var/www/htdocs/.htaccess</code>, they apply to that directory
+only. A <code>.htaccess</code> file in a subdirectory starts with
+an empty ruleset, unless you explicitly enable inheritance.</p>
+
+<p>The <code class="directive"><a href="../mod/mod_rewrite.html#rewriteoptions">RewriteOptions</a></code>
+directive controls this behavior:</p>
+
+<dl>
+<dt><code>RewriteOptions Inherit</code></dt>
+<dd>Rules from the parent context are appended to the current ruleset.
+The child's rules are processed first, then the parent's. Use this
+when a subdirectory needs to add its own rules while keeping the
+parent's rules active.</dd>
+
+<dt><code>RewriteOptions InheritBefore</code></dt>
+<dd>Like <code>Inherit</code>, but the parent's rules are processed
+<em>before</em> the child's. This is useful when the parent defines
+a front-controller pattern and the child needs to add exceptions.
+Available since Apache 2.4.8.</dd>
+
+<dt><code>RewriteOptions InheritDown</code></dt>
+<dd>Set this in the parent context to force all child contexts to
+inherit the parent's rules, without requiring each child to specify
+<code>Inherit</code>. Available since Apache 2.4.8.</dd>
+
+<dt><code>RewriteOptions InheritDownBefore</code></dt>
+<dd>Like <code>InheritDown</code>, but forces the parent's rules to
+run before the child's. Available since Apache 2.4.8.</dd>
+
+<dt><code>RewriteOptions IgnoreInherit</code></dt>
+<dd>Set this in a child context to opt out of inheritance that was
+forced by a parent's <code>InheritDown</code>.
+Available since Apache 2.4.8.</dd>
+
+<dt><code>RewriteOptions MergeBase</code></dt>
+<dd>When inheritance is enabled, the <code>RewriteBase</code> from
+each context is used for rules defined in that context, rather than
+applying the child's <code>RewriteBase</code> to all inherited rules.
+Available since Apache 2.4.26.</dd>
+</dl>
+
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="debugging" id="debugging">Debugging .htaccess rewrite rules</a> <a title="Permanent link" href="#debugging" class="permalink">¶</a></h2>
+
+<p>When <code>.htaccess</code> rules are not doing what you expect,
+the rewrite log is your most important tool. Enable it at the
+appropriate trace level:</p>
+
+<pre class="prettyprint lang-config">LogLevel alert rewrite:trace3</pre>
+
+
+<p>This produces detailed output in the error log showing exactly
+how each rule is processed - what pattern was matched against,
+whether conditions succeeded or failed, and what substitution was
+made. The per-directory context and path stripping behavior will be
+visible in these log entries.</p>
+
+<div class="warning">Do not leave trace-level logging enabled in
+production. It generates a large volume of output and will affect
+performance.</div>
+
+</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../de/rewrite/htaccess.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
<a href="../en/rewrite/htaccess.html" title="English"> en </a> |
<a href="../tr/rewrite/htaccess.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a> |
<a href="../zh-cn/rewrite/htaccess.html" hreflang="zh-cn" rel="alternate" title="Simplified Chinese"> zh-cn </a></p>
</div>
+<div class="outofdate">Esta traducción podría estar
+ obsoleta. Consulte la versión en inglés de la
+ documentación para comprobar si se han producido cambios
+ recientemente.</div>
<p>Este documento complementa la <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
<a href="../tr/rewrite/htaccess.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a> |
<a href="../zh-cn/rewrite/htaccess.html" hreflang="zh-cn" rel="alternate" title="Simplified Chinese"> zh-cn </a></p>
</div>
+<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
+ anglaise pour les changements récents.</div>
<p>Ce document est un complément de la <a href="../mod/mod_rewrite.html">documentation de référence</a> du module
<a href="../tr/rewrite/htaccess.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a> |
<a href="../zh-cn/rewrite/htaccess.html" hreflang="zh-cn" rel="alternate" title="Simplified Chinese"> zh-cn </a></p>
</div>
+<div class="outofdate">この日本語訳はすでに古くなっている
+ 可能性があります。
+ 最近更新された内容を見るには英語版をご覧下さい。
+ </div>
<p>このドキュメントは <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
<a href="../tr/rewrite/htaccess.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a> |
<a href="../zh-cn/rewrite/htaccess.html" hreflang="zh-cn" rel="alternate" title="Simplified Chinese"> zh-cn </a></p>
</div>
+<div class="outofdate">ÀÌ ¹®¼´Â ÃÖ½ÅÆÇ ¹ø¿ªÀÌ ¾Æ´Õ´Ï´Ù.
+ ÃÖ±Ù¿¡ º¯°æµÈ ³»¿ëÀº ¿µ¾î ¹®¼¸¦ Âü°íÇϼ¼¿ä.</div>
<p>�� 문��� <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
<a href="../tr/rewrite/htaccess.html" title="Türkçe"> tr </a> |
<a href="../zh-cn/rewrite/htaccess.html" hreflang="zh-cn" rel="alternate" title="Simplified Chinese"> zh-cn </a></p>
</div>
+<div class="outofdate">Bu çeviri güncel olmayabilir. Son değişiklikler için İngilizce sürüm geçerlidir.</div>
<p>Bu belge, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
<a href="../tr/rewrite/htaccess.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a> |
<a href="../zh-cn/rewrite/htaccess.html" title="Simplified Chinese"> zh-cn </a></p>
</div>
+<div class="outofdate">此翻译可能过期。要了解最近的更改,请阅读英文版。</div>
<p>本文档是 <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
<summary>
<p>Using <module>mod_rewrite</module> in <code>.htaccess</code> files
-is one of the most common — and most confusing —
+is one of the most common - and most confusing -
<glossary ref="perdirectory">per-directory</glossary> configurations.
This document explains the key differences between using rewrite
rules in server configuration versus <code>.htaccess</code> files,
<code>Options SymLinksIfOwnerMatch</code> must be enabled for the
directory in question. Because a
<directive module="mod_rewrite">RewriteRule</directive> can map a URL
-to an arbitrary filesystem path — functionally equivalent to a symbolic
-link — <module>mod_rewrite</module> refuses to operate in per-directory
+to an arbitrary filesystem path - functionally equivalent to a symbolic
+link - <module>mod_rewrite</module> refuses to operate in per-directory
context unless one of these options is set. Without it, you will see
the following error:</p>
<p>For example, if your <code>.htaccess</code> is in
<code>/var/www/htdocs/app/</code> and a request comes in for
<code>/app/products/widget</code>, the RewriteRule sees only
-<code>products/widget</code> — no leading slash, no
+<code>products/widget</code> - no leading slash, no
<code>/app/</code> prefix.</p>
<p>This means you must write your patterns differently depending on
RewriteRule "^(.*)$" "index.php" [L]
</highlight>
-<note>For this particular use case — routing all unmatched
-requests to a front controller — the
+<note>For this particular use case - routing all unmatched
+requests to a front controller - the
<a href="remapping.html#fallback-resource">FallbackResource</a> directive
is a simpler and more efficient alternative to mod_rewrite.</note>
<p>If you're using absolute URLs (starting with <code>/</code> or
<code>http://</code>) in your substitutions,
<directive module="mod_rewrite">RewriteBase</directive> has no effect
-— it only applies to relative substitutions.</p>
+- it only applies to relative substitutions.</p>
</section>
the ruleset." In <code>.htaccess</code> context, it means something
subtly different: "stop processing the ruleset <em>for this pass</em>."
After the substitution is made, Apache re-processes the request from
-the top — including re-applying the <code>.htaccess</code> rules.
+the top - including re-applying the <code>.htaccess</code> rules.
This can lead to infinite loops.</p>
<p>Consider this rule:</p>
<highlight language="config">
-# In .htaccess — this may loop!
+# In .htaccess - this may loop!
RewriteRule "^(.*)$" "/index.php?q=$1" [L]
</highlight>
declared in .htaccess</title>
<p>The <directive module="mod_rewrite">RewriteMap</directive> directive
-can only be declared in server or virtualhost context — not in
+can only be declared in server or virtualhost context - not in
<code>.htaccess</code> files or
<directive module="core" type="section">Directory</directive> blocks.
However, once a map is declared in the server configuration, you
</highlight>
<highlight language="config">
-# In .htaccess — using the map declared above
+# In .htaccess - using the map declared above
RewriteEngine On
RewriteRule "^product/(.+)$" "/prods.php?id=${product2id:$1|NOTFOUND}" [PT]
</highlight>
</highlight>
<p>This produces detailed output in the error log showing exactly
-how each rule is processed — what pattern was matched against,
+how each rule is processed - what pattern was matched against,
whether conditions succeeded or failed, and what substitution was
made. The per-directory context and path stripping behavior will be
visible in these log entries.</p>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.de.xsl"?>
-<!-- English Revision: 1933067 -->
+<!-- English Revision: 1933067:1933671 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.es.xsl"?>
-<!-- English Revision: 1933067 -->
+<!-- English Revision: 1933067:1933671 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1933067 -->
+<!-- English Revision: 1933067:1933671 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
-<!-- English Revision: 1933067 -->
+<!-- English Revision: 1933067:1933671 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version='1.0' encoding='EUC-KR' ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ko.xsl"?>
-<!-- English Revision: 1933067 -->
+<!-- English Revision: 1933067:1933671 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<relpath>..</relpath>
<variants>
- <variant>de</variant>
+ <variant outdated="yes">de</variant>
<variant>en</variant>
- <variant>es</variant>
- <variant>fr</variant>
- <variant>ja</variant>
- <variant>ko</variant>
- <variant>tr</variant>
- <variant>zh-cn</variant>
+ <variant outdated="yes">es</variant>
+ <variant outdated="yes">fr</variant>
+ <variant outdated="yes">ja</variant>
+ <variant outdated="yes">ko</variant>
+ <variant outdated="yes">tr</variant>
+ <variant outdated="yes">zh-cn</variant>
</variants>
</metafile>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.tr.xsl"?>
-<!-- English Revision: 1933067 -->
+<!-- English Revision: 1933067:1933671 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.zh-cn.xsl"?>
-<!-- English Revision: 1933067 -->
+<!-- English Revision: 1933067:1933671 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
Ce document n'a pas pour prétention d'être une référence détaillée des
expressions rationnelles. A cet effet, nous recommandons les <a href="http://pcre.org/pcre.txt">pages de manuel de PCRE</a>, la <a href="http://perldoc.perl.org/perlre.html">page de manuel des
expressions rationnelles Perl</a>, et l'ouvrage <a href="https://www.oreilly.com/library/view/mastering-regular-expressions/0596528124/">Mastering
-Regular Expressions, by Jeffrey Friedl</a> (la troisième édition date
+Regular Expressions, par Jeffrey Friedl</a> (la troisième édition date
de 2006, mais la syntaxe des expressions rationnelles n'a pas vraiment
changé, et cet ouvrage reste la référence en la matière).</p>
<div class="section">
<h2><a name="hostmatching" id="hostmatching">Virtual Host Matching</a> <a title="Permanent link" href="#hostmatching" class="permalink">¶</a></h2>
- <p>The server determines which vhost to use for a request as
- follows:</p>
-
- <h3><a name="hashtable" id="hashtable">IP address lookup</a></h3>
-
- <p>When the connection is first received on some address and port,
- the server looks for all the <code>VirtualHost</code> definitions
- that have the same IP address and port.</p>
-
- <p>If there are no exact matches for the address and port, then
- wildcard (<code>*</code>) matches are considered.</p>
-
- <p>If no matches are found, the request is served by the
- main server.</p>
+ <p>The server determines which vhost to use for a request in two
+ phases: an IP-based match when the connection is established,
+ then an optional name-based match when the request is received.</p>
+
+ <h3><a name="hashtable" id="hashtable">Phase 1: IP address and port matching</a></h3>
+
+ <p>When a connection is first received, the server looks up the
+ destination IP address and port in its list of
+ <code>VirtualHost</code> addresses. This lookup follows a strict
+ priority order:</p>
+
+ <table class="bordered"><tr class="header"><th>Priority</th><th>Match type</th><th>Example</th></tr>
+<tr><td>1</td><td>Exact IP address, exact port</td>
+ <td><code><VirtualHost 10.0.0.1:80></code></td></tr>
+<tr class="odd"><td>2</td><td>Exact IP address, wildcard port</td>
+ <td><code><VirtualHost 10.0.0.1:*></code></td></tr>
+<tr><td>3</td><td>Wildcard address (<code>*</code>), exact port</td>
+ <td><code><VirtualHost *:80></code></td></tr>
+<tr class="odd"><td>4</td><td>Wildcard address, wildcard port</td>
+ <td><code><VirtualHost *:*></code></td></tr>
+<tr><td>5</td><td>Main server</td>
+ <td>(no matching <code>VirtualHost</code>)</td></tr>
+</table>
+
+ <div class="note"><h3>Important</h3>
+ <p>The server uses the <em>first match found</em> following this
+ priority order. Once a match is found at a given priority level,
+ no lower-priority levels are considered — even if a
+ lower-priority vhost has a <code>ServerName</code> that matches the
+ request's <code>Host</code> header. Name-based matching (Phase 2)
+ only occurs among vhosts that tied at the same priority level.</p>
+ </div>
<p>If there are <code>VirtualHost</code> definitions for
the IP address, the next step is to decide if we have to
<h3><a name="ipbased" id="ipbased">IP-based vhost</a></h3>
- <p>If there is exactly one <code>VirtualHost</code> directive
- listing the IP address and port combination that was determined
- to be the best match, no further actions are performed and
- the request is served from the matching vhost.</p>
+ <p>If Phase 1 produces exactly one matching
+ <code>VirtualHost</code>, the request is served directly from that
+ vhost with no further matching.</p>
- <h3><a name="namebased" id="namebased">Name-based vhost</a></h3>
+ <h3><a name="namebased" id="namebased">Phase 2: Name-based matching</a></h3>
- <p>If there are multiple <code>VirtualHost</code> directives listing
- the IP address and port combination that was determined to be the
- best match, the "list" in the remaining steps refers to the list of vhosts
- that matched, in the order they were in the configuration file.</p>
+ <p>If Phase 1 produces multiple <code>VirtualHost</code>
+ definitions at the same priority level, the server performs
+ name-based matching among those vhosts using the
+ <code>Host:</code> header from the request (or the SNI hostname
+ for SSL connections).</p>
<p>If the connection is using SSL, the server supports <a class="glossarylink" href="../glossary.html#servernameindication" title="see glossary">Server Name Indication</a>, and
the SSL client handshake includes the TLS extension with the
vhost determines which certificate the server will use for the
connection.</p>
- <p>If the request contains a <code>Host:</code> header field, the
- list is searched for the first vhost with a matching
- <code>ServerName</code> or <code>ServerAlias</code>, and the
- request is served from that vhost. A <code>Host:</code> header
- field can contain a port number, but Apache always ignores it and
- matches against the real port to which the client sent the
- request.</p>
+ <p>The matching vhosts are searched in the order they appear in
+ the configuration file:</p>
+
+ <ol>
+ <li>The <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code> and
+ <code class="directive"><a href="../mod/core.html#serveralias">ServerAlias</a></code> of each vhost
+ are compared against the hostname from the request. The first
+ match wins.</li>
+
+ <li>If no <code>ServerName</code> or <code>ServerAlias</code>
+ matches, the <em>first vhost in the list</em> is used. This is
+ the <em>default name-based vhost</em> for that address and port
+ combination.</li>
+ </ol>
+
+ <p>A <code>Host:</code> header field can contain a port number,
+ but Apache always ignores it and matches against the real port to
+ which the client sent the request.</p>
- <p>The first vhost in the config
- file with the specified IP address has the highest priority
- and catches any request to an unknown server name, or a request
- without a <code>Host:</code> header field (such as a HTTP/1.0
- request).</p>
+ <p>If the request has no <code>Host:</code> header (such as a
+ HTTP/1.0 request), the first matching vhost is used. If a
+ <code class="directive"><a href="../mod/core.html#serverpath">ServerPath</a></code> is configured for
+ any of the matching vhosts and the request URL matches that path,
+ the request is served from that vhost instead. This is a legacy
+ mechanism for HTTP/1.0 clients; see the
+ <a href="examples.html#serverpath">ServerPath example</a> for
+ details.</p>
<h3><a name="persistent" id="persistent">Persistent connections</a></h3>
- <p>The <em>IP lookup</em> described above is only done <em>once</em> for a
- particular TCP/IP session while the <em>name lookup</em> is done on
- <em>every</em> request during a KeepAlive/persistent
- connection. In other words, a client may request pages from
- different name-based vhosts during a single persistent
- connection.</p>
+ <p>The IP-based lookup (Phase 1) is performed only <em>once</em>
+ for a particular TCP/IP session, while the name-based lookup
+ (Phase 2) is performed on <em>every</em> request during a
+ KeepAlive/persistent connection. In other words, a client may
+ request pages from different name-based vhosts during a single
+ persistent connection.</p>
relative URI is served by the corresponding main server or
virtual host. If it does not match, then the URI remains
untouched and the request is taken to be a proxy request.</p>
-
+
<h3><a name="observations" id="observations">Observations</a></h3>
<ul>
- <li>Name-based virtual hosting is a process applied after
- the server has selected the best matching IP-based virtual
- host.</li>
+ <li>Name-based virtual hosting is a process applied <em>after</em>
+ the server has narrowed the candidate list via IP-based matching.</li>
<li>If you don't care what IP address the client has connected to, use a
- "*" as the address of every virtual host, and name-based virtual hosting
+ "<code>*</code>" as the address of every virtual host, and name-based virtual hosting
is applied across all configured virtual hosts.</li>
<li><code>ServerName</code> and <code>ServerAlias</code>
- checks are never performed for an IP-based vhost.</li>
+ checks are never performed for an IP-based vhost (one where
+ there is only a single vhost for that IP:port).</li>
<li>Only the ordering of
name-based vhosts for a specific address set is significant.
- The one name-based vhosts that comes first in the
+ The one name-based vhost that comes first in the
configuration file has the highest priority for its
corresponding address set.</li>
<a href="../ko/vhosts/details.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
<a href="../tr/vhosts/details.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
</div>
+<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
+ anglaise pour les changements récents.</div>
<p>Ce document vise à expliquer dans le détail comment le serveur
<?xml version='1.0' encoding="UTF-8"?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1777061 -->
+<!-- English Revision: 1777061:1933669 (outdated) -->
<!-- French translation by Vincent Deffontaines, review by alain B -->
<!-- Updated by Lucien Gentis -->
<?xml version='1.0' encoding='EUC-KR' ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.ko.xsl"?>
-<!-- English Revision: 105989:1777061 (outdated) -->
+<!-- English Revision: 105989:1933669 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<variants>
<variant>en</variant>
- <variant>fr</variant>
+ <variant outdated="yes">fr</variant>
<variant outdated="yes">ko</variant>
<variant outdated="yes">tr</variant>
</variants>
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.tr.xsl"?>
-<!-- English Revision: 1301735:1777061 (outdated) -->
+<!-- English Revision: 1301735:1933669 (outdated) -->
<!-- =====================================================
Translated by: Nilgün Belma Bugüner <nilgun belgeler.org>
Reviewed by: Orhan Berent <berent belgeler.org>