<table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_authz_host.html">mod_authz_host</a></code></li><li><code class="module"><a href="./mod/mod_cgi.html">mod_cgi</a></code></li><li><code class="module"><a href="./mod/mod_ext_filter.html">mod_ext_filter</a></code></li><li><code class="module"><a href="./mod/mod_headers.html">mod_headers</a></code></li><li><code class="module"><a href="./mod/mod_include.html">mod_include</a></code></li><li><code class="module"><a href="./mod/mod_log_config.html">mod_log_config</a></code></li><li><code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_authz_core.html#require">Require</a></code></li><li><code class="directive"><a href="./mod/mod_log_config.html#customlog">CustomLog</a></code></li><li><code class="directive"><a href="./mod/mod_access_compat.html#allow">Allow</a></code></li><li><code class="directive"><a href="./mod/mod_access_compat.html#deny">Deny</a></code></li><li><code class="directive"><a href="./mod/mod_ext_filter.html#extfilterdefine">ExtFilterDefine</a></code></li><li><code class="directive"><a href="./mod/mod_headers.html#header">Header</a></code></li><li><code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewritecond">RewriteCond</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewriterule">RewriteRule</a></code></li></ul></td></tr></table>
+ <div class="note">
+ <h3>Modern alternative: Expressions</h3>
+ <p>Many use cases that previously required setting and testing
+ environment variables — including conditional headers, access
+ control, and logging — can now be handled more directly using
+ <code class="directive"><a href="./mod/core.html#if"><If></a></code> expressions
+ with the <code>reqenv</code> function. See
+ <a href="expr.html">Expressions in Apache HTTP Server</a> for the
+ expression syntax and the full list of available
+ <a href="expr.html#vars">variables</a>.</p>
+ </div>
+
<h3><a name="cgi-scripts" id="cgi-scripts">CGI Scripts</a></h3>
allows for flexible control of access to the server based on
characteristics of the client. For example, you can use these
directives to deny access to a particular browser (User-Agent).
+ For more complex conditions,
+ <a href="expr.html"><code>Require expr</code></a> provides
+ an alternative that can evaluate environment variables using
+ the <code>reqenv</code> function alongside other request properties.
</p>
These have been adopted more broadly, and are a standard
part of passing information between the browser and the
server, and between processes on the server side. Here we
- discuss a few of these. Refer to the CGI spec for further
- details.</p>
+ discuss a few of these. For the complete list of request
+ variables available in <a href="expr.html">expressions</a>
+ (including <code>REQUEST_URI</code>, <code>REMOTE_ADDR</code>,
+ <code>SERVER_NAME</code>, and many others), see the
+ <a href="expr.html#vars">expression variables</a> reference.</p>
+
+ <p>Refer to the CGI spec for further details of the standard
+ CGI meta-variables.</p>
<h3><a name="query-string" id="query-string">QUERY_STRING</a></h3>
<?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: 1933549:1934245 (outdated) -->
+<!-- English Revision: 1933549:1934599 (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: 659902:1934245 (outdated) -->
+<!-- English Revision: 659902:1934599 (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:1934245 (outdated) -->
+<!-- English Revision: 105989:1934599 (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: 1300910:1934245 (outdated) -->
+<!-- English Revision: 1300910:1934599 (outdated) -->
<!-- =====================================================
Translated by: Nilgün Belma Bugüner <nilgun belgeler.org>
Reviewed by: Orhan Berent <berent belgeler.org>
<li><img alt="" src="./images/down.gif" /> <a href="#sslrequire">Comparison with SSLRequire</a></li>
<li><img alt="" src="./images/down.gif" /> <a href="#compatibility">Version History</a></li>
<li><img alt="" src="./images/down.gif" /> <a href="#examples">Example expressions</a></li>
-</ul><h3>See also</h3><ul class="seealso"><li><code class="directive"><a href="./mod/core.html#if"><If></a></code></li><li><code class="directive"><a href="./mod/core.html#elseif"><ElseIf></a></code></li><li><code class="directive"><a href="./mod/core.html#else"><Else></a></code></li><li><code class="directive"><a href="./mod/core.html#errordocument">ErrorDocument</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#alias">Alias</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#scriptalias">ScriptAlias</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#redirect">Redirect</a></code></li><li><code class="directive"><a href="./mod/mod_auth_basic.html#authbasicfake">AuthBasicFake</a></code></li><li><code class="directive"><a href="./mod/mod_auth_form.html#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></code></li><li><code class="directive"><a href="./mod/mod_auth_form.html#authformloginsuccesslocation">AuthFormLoginSuccessLocation</a></code></li><li><code class="directive"><a href="./mod/mod_auth_form.html#authformlogoutlocation">AuthFormLogoutLocation</a></code></li><li><code class="directive"><a href="./mod/mod_authn_core.html#authname">AuthName</a></code></li><li><code class="directive"><a href="./mod/mod_authn_core.html#authtype">AuthType</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewritecond">RewriteCond</a></code></li><li><code class="directive"><a href="./mod/mod_setenvif.html#setenvifexpr">SetEnvIfExpr</a></code></li><li><code class="directive"><a href="./mod/mod_headers.html#header">Header</a></code></li><li><code class="directive"><a href="./mod/mod_headers.html#requestheader">RequestHeader</a></code></li><li><code class="directive"><a href="./mod/mod_filter.html#filterprovider">FilterProvider</a></code></li><li><code class="directive"><a href="./mod/mod_crypto.html#cryptokey">CryptoKey</a></code></li><li><code class="directive"><a href="./mod/mod_crypto.html#cryptoiv">CryptoIV</a></code></li><li><a href="mod/mod_authz_core.html#reqexpr">Require expr</a></li><li><a href="mod/mod_authnz_ldap.html#requser">Require ldap-user</a></li><li><a href="mod/mod_authnz_ldap.html#reqgroup">Require ldap-group</a></li><li><a href="mod/mod_authnz_ldap.html#reqdn">Require ldap-dn</a></li><li><a href="mod/mod_authnz_ldap.html#reqattribute">Require ldap-attribute</a></li><li><a href="mod/mod_authnz_ldap.html#reqfilter">Require ldap-filter</a></li><li><a href="mod/mod_authnz_ldap.html#reqsearch">Require ldap-search</a></li><li><a href="mod/mod_authz_dbd.html#reqgroup">Require dbd-group</a></li><li><a href="mod/mod_authz_dbm.html#reqgroup">Require dbm-group</a></li><li><a href="mod/mod_authz_groupfile.html#reqgroup">Require group</a></li><li><a href="mod/mod_authz_host.html#reqhost">Require host</a></li><li><code class="directive"><a href="./mod/mod_ssl.html#sslrequire">SSLRequire</a></code></li><li><code class="directive"><a href="./mod/mod_log_debug.html#logmessage">LogMessage</a></code></li><li><code class="module"><a href="./mod/mod_include.html">mod_include</a></code></li></ul></div>
+</ul><h3>See also</h3><ul class="seealso"><li><code class="directive"><a href="./mod/core.html#if"><If></a></code></li><li><code class="directive"><a href="./mod/core.html#elseif"><ElseIf></a></code></li><li><code class="directive"><a href="./mod/core.html#else"><Else></a></code></li><li><code class="directive"><a href="./mod/core.html#errordocument">ErrorDocument</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#alias">Alias</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#scriptalias">ScriptAlias</a></code></li><li><code class="directive"><a href="./mod/mod_alias.html#redirect">Redirect</a></code></li><li><code class="directive"><a href="./mod/mod_auth_basic.html#authbasicfake">AuthBasicFake</a></code></li><li><code class="directive"><a href="./mod/mod_auth_form.html#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></code></li><li><code class="directive"><a href="./mod/mod_auth_form.html#authformloginsuccesslocation">AuthFormLoginSuccessLocation</a></code></li><li><code class="directive"><a href="./mod/mod_auth_form.html#authformlogoutlocation">AuthFormLogoutLocation</a></code></li><li><code class="directive"><a href="./mod/mod_authn_core.html#authname">AuthName</a></code></li><li><code class="directive"><a href="./mod/mod_authn_core.html#authtype">AuthType</a></code></li><li><code class="directive"><a href="./mod/mod_rewrite.html#rewritecond">RewriteCond</a></code></li><li><code class="directive"><a href="./mod/mod_setenvif.html#setenvifexpr">SetEnvIfExpr</a></code></li><li><code class="directive"><a href="./mod/mod_headers.html#header">Header</a></code></li><li><code class="directive"><a href="./mod/mod_headers.html#requestheader">RequestHeader</a></code></li><li><code class="directive"><a href="./mod/mod_filter.html#filterprovider">FilterProvider</a></code></li><li><code class="directive"><a href="./mod/mod_crypto.html#cryptokey">CryptoKey</a></code></li><li><code class="directive"><a href="./mod/mod_crypto.html#cryptoiv">CryptoIV</a></code></li><li><a href="mod/mod_authz_core.html#reqexpr">Require expr</a></li><li><a href="mod/mod_authnz_ldap.html#requser">Require ldap-user</a></li><li><a href="mod/mod_authnz_ldap.html#reqgroup">Require ldap-group</a></li><li><a href="mod/mod_authnz_ldap.html#reqdn">Require ldap-dn</a></li><li><a href="mod/mod_authnz_ldap.html#reqattribute">Require ldap-attribute</a></li><li><a href="mod/mod_authnz_ldap.html#reqfilter">Require ldap-filter</a></li><li><a href="mod/mod_authnz_ldap.html#reqsearch">Require ldap-search</a></li><li><a href="mod/mod_authz_dbd.html#reqgroup">Require dbd-group</a></li><li><a href="mod/mod_authz_dbm.html#reqgroup">Require dbm-group</a></li><li><a href="mod/mod_authz_groupfile.html#reqgroup">Require group</a></li><li><a href="mod/mod_authz_host.html#reqhost">Require host</a></li><li><code class="directive"><a href="./mod/mod_ssl.html#sslrequire">SSLRequire</a></code></li><li><code class="directive"><a href="./mod/mod_log_debug.html#logmessage">LogMessage</a></code></li><li><code class="module"><a href="./mod/mod_include.html">mod_include</a></code></li><li><a href="env.html">Environment Variables in Apache httpd</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="grammar" id="grammar">Grammar in Backus-Naur Form notation</a> <a title="Permanent link" href="#grammar" class="permalink">¶</a></h2>
directive is evaluated before authentication is done. Therefore,
<code>%{REMOTE_USER}</code> will not be set in this case.</p>
+ <p>For information on setting and manipulating request environment
+ variables (using <code class="directive"><a href="./mod/mod_env.html#setenv">SetEnv</a></code>,
+ <code class="directive"><a href="./mod/mod_setenvif.html#setenvif">SetEnvIf</a></code>,
+ <code class="module"><a href="./mod/mod_rewrite.html">mod_rewrite</a></code>'s <code>[E=...]</code> flag, and
+ others), see <a href="env.html">Environment Variables in Apache httpd</a>.</p>
+
<p>The following variables provide the values of the named HTTP request
headers. The values of other headers can be obtained with the
<code>req</code> <a href="#functions">function</a>. Using these
exact timing depends on the directive the expression has been used within.
</div>
+ <p>The <code>reqenv</code> function can be used to test
+ <a href="env.html#special">special-purpose environment variables</a>
+ (such as <code>no-gzip</code>, <code>nokeepalive</code>, etc.) as
+ well as any variables set via <a href="env.html#setting">SetEnv,
+ SetEnvIf, or mod_rewrite</a>.</p>
+
<p>When the functions <code>req</code> or <code>http</code> are used,
the header name will automatically be added to the Vary header of the
HTTP response, except where otherwise noted for the directive accepting
<?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: 1926342:1934245 (outdated) -->
+<!-- English Revision: 1926342:1934599 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 180" width="700" height="180">
+ <defs>
+ <marker id="arrowhead-blue" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
+ <polygon points="0 0, 8 3, 0 6" fill="#2563eb"/>
+ </marker>
+ <marker id="arrowhead-red" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
+ <polygon points="0 0, 8 3, 0 6" fill="#dc2626"/>
+ </marker>
+ <marker id="arrowhead-green" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
+ <polygon points="0 0, 8 3, 0 6" fill="#16a34a"/>
+ </marker>
+ <style>
+ text { font-family: "Courier New", Courier, monospace; font-size: 11px; fill: #333; }
+ .sans { font-family: Arial, Helvetica, sans-serif; }
+ .label { font-family: Arial, Helvetica, sans-serif; font-size: 9px; }
+ .directive { font-weight: bold; fill: #000; }
+ .ref1 { fill: #2563eb; font-weight: bold; }
+ .ref2 { fill: #16a34a; font-weight: bold; }
+ .refcond { fill: #dc2626; font-weight: bold; }
+ rect.hl1 { fill: #dbeafe; stroke: #2563eb; stroke-width: 1.5; rx: 2; ry: 2; }
+ rect.hl2 { fill: #dcfce7; stroke: #16a34a; stroke-width: 1.5; rx: 2; ry: 2; }
+ rect.hlc { fill: #fee2e2; stroke: #dc2626; stroke-width: 1.5; rx: 2; ry: 2; }
+ </style>
+ </defs>
+
+ <!-- Line 1: RewriteCond %{DOCUMENT_ROOT}/$1 !-f -->
+ <text x="10" y="25" class="directive">RewriteCond</text>
+ <text x="100" y="25">%{DOCUMENT_ROOT}/</text>
+ <text x="220" y="25" class="ref1">$1</text>
+ <text x="240" y="25">!-f</text>
+
+ <!-- Line 2: RewriteCond %{HTTP_HOST} ^(admin.example.com)$ -->
+ <text x="10" y="55" class="directive">RewriteCond</text>
+ <text x="100" y="55">%{HTTP_HOST} ^</text>
+ <rect class="hlc" x="206" y="41" width="130" height="18"/>
+ <text x="208" y="55" class="refcond">(admin.example.com)</text>
+ <text x="338" y="55">$</text>
+
+ <!-- Line 3: RewriteRule ^/?([a-z]+)/(.*)$ /admin.foo?page=$1&id=$2&host=%1 [PT] -->
+ <text x="10" y="95" class="directive">RewriteRule</text>
+ <text x="100" y="95">^/?</text>
+ <rect class="hl1" x="117" y="81" width="58" height="18"/>
+ <text x="119" y="95" class="ref1">([a-z]+)</text>
+ <text x="176" y="95">/</text>
+ <rect class="hl2" x="183" y="81" width="33" height="18"/>
+ <text x="185" y="95" class="ref2">(.*)</text>
+ <text x="217" y="95">$</text>
+
+ <text x="245" y="95">/admin.foo?page=</text>
+ <text x="365" y="95" class="ref1">$1</text>
+ <text x="379" y="95">&id=</text>
+ <text x="407" y="95" class="ref2">$2</text>
+ <text x="421" y="95">&host=</text>
+ <text x="462" y="95" class="refcond">%1</text>
+ <text x="485" y="95">[PT]</text>
+
+ <!-- Arrow: $1 from Rule ([a-z]+) UP to Cond 1 TestString $1 (blue) -->
+ <path d="M 146,81 C 146,60 220,40 222,29"
+ style="stroke: #2563eb; stroke-width: 2; fill: none; marker-end: url(#arrowhead-blue);"/>
+
+ <!-- Arrow: $1 from Rule ([a-z]+) RIGHT to Substitution $1 (blue) -->
+ <path d="M 146,99 C 146,125 365,125 371,99"
+ style="stroke: #2563eb; stroke-width: 2; fill: none; marker-end: url(#arrowhead-blue);"/>
+ <text x="250" y="132" class="label ref1">$1</text>
+
+ <!-- Arrow: $2 from Rule (.*) RIGHT to Substitution $2 (green) -->
+ <path d="M 200,99 C 200,140 407,140 413,99"
+ style="stroke: #16a34a; stroke-width: 2; fill: none; marker-end: url(#arrowhead-green);"/>
+ <text x="310" y="148" class="label ref2">$2</text>
+
+ <!-- Arrow: %1 from Cond 2 (admin.example.com) DOWN to Substitution %1 (red) -->
+ <path d="M 270,59 C 350,65 462,70 468,81"
+ style="stroke: #dc2626; stroke-width: 2; fill: none; marker-end: url(#arrowhead-red);"/>
+ <text x="390" y="68" class="label refcond">%1</text>
+
+ <!-- Legend -->
+ <text x="10" y="175" class="sans label" style="fill: #666;">Blue $1, $2 = captured from RewriteRule Pattern (matched first). Red %1 = captured from last matched RewriteCond. $1 also available in Cond TestStrings.</text>
+</svg>
\ No newline at end of file
<p>It provides a flexible and powerful way to manipulate URLs using an
unlimited number of rules. Each rule can have an
unlimited number of attached rule conditions, to allow you to rewrite URLs
- based on server variables, environment variables, cookies, HTTP headers,
- or timestamps. Rules can operate on the
+ based on <a href="#rewritecond">server variables</a> (including HTTP
+ headers, connection details, and timestamps), environment variables,
+ or other request properties. Rules can operate on the
<a href="directive-dict.html#Syntax">URL-path</a> (including any
<a href="core.html#acceptpathinfo">trailing pathname information</a>)
and can also alter the
RewriteMap</a> for more details.
</li>
<li>
- <strong>Server-Variables</strong>: These are variables of
+ <strong>Server variables</strong>: These are variables of
the form
<strong><code>%{</code> <em>NAME_OF_VARIABLE</em>
<code>}</code></strong>
<li>back-references (<code>%N</code>) to the last matched
RewriteCond pattern</li>
- <li>server-variables as in rule condition test-strings
+ <li>server variables as in rule condition test-strings
(<code>%{VARNAME}</code>)</li>
<li><a href="#mapfunc">mapping-function</a> calls
matched
<code class="directive"><a href="#rewritecond">RewriteCond</a></code>
<em>CondPattern</em>: <code>%0</code> is the entire match and
- <code>%1</code>..<code>%9</code> are the captured groups. The server-variables are the same
+ <code>%1</code>..<code>%9</code> are the captured groups. 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>B</td>
<td>Escape non-alphanumeric characters in backreferences <em>before</em>
- applying the transformation. For similar escaping of server-variables, see
+ applying the transformation. For similar escaping of server variables, see
the "escape" <a href="#mapfunc">mapping-function</a>.<em><a href="../rewrite/flags.html#flag_b">details ...</a></em></td>
</tr>
<tr class="odd">
<?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: 1934137:1934512 (outdated) -->
+<!-- English Revision: 1934137:1934605 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
Using the B flag, non-alphanumeric characters in backreferences
will be escaped. For example, consider the rule:</p>
-<p>For similar escaping of server-variables, see
+<p>For similar escaping of server variables, see
the "escape" <a href="#mapfunc">mapping-function</a></p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="flag_dpi" id="flag_dpi">DPI|discardpath</a> <a title="Permanent link" href="#flag_dpi" class="permalink">¶</a></h2>
-<p>The DPI flag causes the <a class="glossarylink" href="../glossary.html#pathinfo" title="see glossary">PATH_INFO</a> portion of the rewritten URL-path to be
-discarded.</p>
-
-<p>In <a class="glossarylink" href="../glossary.html#perdirectory" title="see glossary">per-directory context</a>,
-the URL-path each <code class="directive">RewriteRule</code> compares against
-is the concatenation of the current URL-path and PATH_INFO.</p>
+<p>The DPI flag causes the <a class="glossarylink" href="../glossary.html#pathinfo" title="see glossary">PATH_INFO</a>
+that was appended to the rewritten
+<a class="glossarylink" href="../glossary.html#urlpath" title="see glossary">URL-path</a> to be discarded.</p>
+
+<p>In <a class="glossarylink" href="../glossary.html#perdirectory" title="see glossary">per-directory context</a>, the
+<a class="glossarylink" href="../glossary.html#urlpath" title="see glossary">URL-path</a> each
+<code class="directive">RewriteRule</code> compares against is the concatenation
+of the current URL-path and PATH_INFO.</p>
<p>The current URL-path can be the initial path as requested by the
client, the result of a previous round of <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
<?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: 1933062:1934324 (outdated) -->
+<!-- English Revision: 1933062:1934605 (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: 1933062:1934324 (outdated) -->
+<!-- English Revision: 1933062:1934605 (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: 1933062:1934324 (outdated) -->
+<!-- English Revision: 1933062:1934605 (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: 1933062:1934324 (outdated) -->
+<!-- English Revision: 1933062:1934605 (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: 1933062:1934324 (outdated) -->
+<!-- English Revision: 1933062:1934605 (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: 1933062:1934324 (outdated) -->
+<!-- English Revision: 1933062:1934605 (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: 1933062:1934324 (outdated) -->
+<!-- English Revision: 1933062:1934605 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
<p class="figure">
<img src="../images/rewrite_backreferences.png" alt="Flow of RewriteRule and RewriteCond matching" /><br />
<dfn>Figure 1:</dfn> The back-reference flow through a rule.<br />
- In this example, a request for <code>/test/1234</code> would be transformed into <code>/admin.foo?page=test&id=1234&host=admin.example.com</code>.
+ In this example, a request for <code>/test/1234</code> to host <code>admin.example.com</code> would be transformed into <code>/admin.foo?page=test&id=1234&host=admin.example.com</code>, provided that <code>%{DOCUMENT_ROOT}/test</code> is not an existing file.
</p>
+ <p>See also <a href="tech.html#InternalRuleset">Technical Details</a>
+ for a diagram showing backreference flow with multiple conditions.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<img src="../images/rewrite_backreferences.png"
alt="Flow of RewriteRule and RewriteCond matching" /><br />
<dfn>Figure 1:</dfn> The back-reference flow through a rule.<br />
- In this example, a request for <code>/test/1234</code> would be transformed into <code>/admin.foo?page=test&id=1234&host=admin.example.com</code>.
+ In this example, a request for <code>/test/1234</code> to host <code>admin.example.com</code> would be transformed into <code>/admin.foo?page=test&id=1234&host=admin.example.com</code>, provided that <code>%{DOCUMENT_ROOT}/test</code> is not an existing file.
</p>
<p>See also <a href="tech.html#InternalRuleset">Technical Details</a>
for a diagram showing backreference flow with multiple conditions.</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: 1933423:1934482 (outdated) -->
+<!-- English Revision: 1933423:1934612 (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: 1933423:1934482 (outdated) -->
+<!-- English Revision: 1933423:1934612 (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: 1933423:1934482 (outdated) -->
+<!-- English Revision: 1933423:1934612 (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: 1933423:1934482 (outdated) -->
+<!-- English Revision: 1933423:1934612 (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: 1933423:1934482 (outdated) -->
+<!-- English Revision: 1933423:1934612 (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: 1933423:1934482 (outdated) -->
+<!-- English Revision: 1933423:1934612 (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: 1933423:1934482 (outdated) -->
+<!-- English Revision: 1933423:1934612 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
configuration contexts. Only the final result processing is
different.</p>
+<p class="figure">
+ <img src="../images/mod_rewrite_fig1.png" alt="Overview of per-request rewrite processing through per-server and per-directory phases" /><br />
+ <dfn>Figure 1:</dfn>The per-request rewrite process showing
+ both per-server and per-directory rule processing phases
+</p>
+
<p>The order of rules in the ruleset is important because the
rewriting engine processes them in a special (and not very
obvious) order. The rule is this: The rewriting engine loops
existing corresponding conditions (<code>RewriteCond</code>
directives). For historical reasons the conditions are given
first, and so the control flow is a little bit long-winded. See
- Figure 1 for more details.</p>
+ Figure 2 for more details.</p>
<p class="figure">
<img src="../images/rewrite_process_uri.png" alt="Flow of RewriteRule and RewriteCond matching" /><br />
- <dfn>Figure 1:</dfn>The control flow through the rewriting ruleset
+ <dfn>Figure 2:</dfn>The control flow through the rewriting ruleset
</p>
<p>First the URL is matched against the
<em>Pattern</em> of each rule. If it fails, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
with the substitution of the URL with
<em>Substitution</em>.</p>
+<p class="figure">
+ <img src="../images/mod_rewrite_fig2.png" alt="Flow of backreferences between RewriteRule and RewriteCond directives" /><br />
+ <dfn>Figure 3:</dfn>The flow of backreferences through a rule.
+ RewriteRule Pattern is matched first; its captures ($1...$9)
+ are available in all RewriteCond TestStrings. The last matched
+ CondPattern's captures (%1...%9) are available in Substitution.
+</p>
+
</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../de/rewrite/tech.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
<?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: 1933438:1934233 (outdated) -->
+<!-- English Revision: 1933438:1934612 (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: 1933438:1934233 (outdated) -->
+<!-- English Revision: 1933438:1934612 (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: 1934122:1934233 (outdated) -->
+<!-- English Revision: 1934122:1934612 (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: 1933438:1934233 (outdated) -->
+<!-- English Revision: 1933438:1934612 (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: 1933438:1934233 (outdated) -->
+<!-- English Revision: 1933438:1934612 (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: 1933438:1934233 (outdated) -->
+<!-- English Revision: 1933438:1934612 (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: 1933438:1934233 (outdated) -->
+<!-- English Revision: 1933438:1934612 (outdated) -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more