summaryrefslogtreecommitdiffstats
path: root/docs/manual/mod/mod_rewrite.html.en
diff options
context:
space:
mode:
Diffstat (limited to 'docs/manual/mod/mod_rewrite.html.en')
-rw-r--r--docs/manual/mod/mod_rewrite.html.en86
1 files changed, 72 insertions, 14 deletions
diff --git a/docs/manual/mod/mod_rewrite.html.en b/docs/manual/mod/mod_rewrite.html.en
index 5de13b8..a46bb22 100644
--- a/docs/manual/mod/mod_rewrite.html.en
+++ b/docs/manual/mod/mod_rewrite.html.en
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
-<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
+<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
@@ -27,13 +27,13 @@
<div id="preamble"><h1>Apache Module mod_rewrite</h1>
<div class="toplang">
<p><span>Available Languages: </span><a href="../en/mod/mod_rewrite.html" title="English">&nbsp;en&nbsp;</a> |
-<a href="../fr/mod/mod_rewrite.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a></p>
+<a href="../fr/mod/mod_rewrite.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a></p>
</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides a rule-based rewriting engine to rewrite requested
URLs on the fly</td></tr>
<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
-<tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>rewrite_module</td></tr>
-<tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_rewrite.c</td></tr></table>
+<tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>rewrite_module</td></tr>
+<tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_rewrite.c</td></tr></table>
<h3>Summary</h3>
<p>The <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> module uses a rule-based rewriting
@@ -364,7 +364,11 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3"
<dd>The path component of the requested URI,
such as "/index.html". This notably excludes the
query string which is available as its own variable
- named <code>QUERY_STRING</code>.</dd>
+ named <code>QUERY_STRING</code>. The value returned for
+ <code>REQUEST_URI</code>
+ has already been %-decoded, to re-encode it pass it through
+ the "escape" <a href="#mapfunc">mapping-function</a>.
+ </dd>
<dt><code>THE_REQUEST</code></dt>
@@ -531,6 +535,14 @@ AliasMatch "^/myapp" "/opt/myapp-1.2.3"
<em>CondPattern</em>, or is equal to <em>CondPattern</em>
(the two strings are equal, character for character).</dd>
</dl>
+ <div class="note"><h3>Note</h3>
+ The string comparison operator is part of the <em>CondPattern</em>
+ argument and must be included in the quotes if those are used. Eg.
+
+ <pre class="prettyprint lang-config">RewriteCond %{HTTP_USER_AGENT} "=This Robot/1.0"</pre>
+
+ </div>
+
</li>
<li>
@@ -749,6 +761,13 @@ RewriteRule "^/$" "/homepage.std.html" [L]</pre>
the homepage is served. Otherwise, the standard page is served.
</p>
+ <p>By default, multiple <code class="directive">RewriteCond</code>s
+ are evaluated in sequence with an implied logical <strong>AND</strong>.
+ If a condition fails, in the absence of an
+ <strong><code>OR</code></strong> flag, the entire ruleset is abandoned,
+ and further conditions are not evaluated.
+ </p>
+
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
@@ -1125,7 +1144,30 @@ matches in per-directory context.</li>
(including their regular expression counterparts), this
should never be necessary and is unsupported. A likely feature
to break in these contexts is relative substitutions.</li>
+
+<li>The <code class="directive"><a href="../mod/core.html#if">If</a></code> blocks
+follow the rules of the <em>directory</em> context.</li>
+
+<li>By default, mod_rewrite overrides rules when <a href="../sections.html#merging">
+merging sections</a> belonging to the same context. The <code class="directive"><a href="#rewriteoptions">RewriteOptions</a></code> directive can change this behavior,
+for example using the <em>Inherit</em> setting.</li>
+
+<li>The <code class="directive"><a href="#rewriteoptions">RewriteOptions</a></code> also regulates the
+behavior of sections that are stated at the same nesting level of the configuration. In the
+following example, by default only the RewriteRules stated in the second
+<code class="directive"><a href="../mod/core.html#if">If</a></code> block
+are considered, since the first ones are overridden. Using <code class="directive"><a href="#rewriteoptions">RewriteOptions</a></code> Inherit forces mod_rewrite to merge the two
+sections and consider both set of statements, rather than only the last one.</li>
</ul>
+<div class="example"><pre class="prettyprint lang-config">&lt;If "true"&gt;
+ # Without RewriteOptions Inherit, this rule is overridden by the next
+ # section and no redirect will happen for URIs containing 'foo'
+ RewriteRule foo http://example.com/foo [R]
+&lt;/If&gt;
+&lt;If "true"&gt;
+ RewriteRule bar http://example.com/bar [R]
+&lt;/If&gt;</pre>
+</div>
</div>
<p>For some hints on <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
@@ -1184,13 +1226,16 @@ cannot use <code>$N</code> in the substitution string!
<dt>Absolute URL</dt>
- <dd>If an absolute URL is specified,
+ <dd><p>If an absolute URL is specified,
<code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> checks to see whether the
hostname matches the current host. If it does, the scheme and
hostname are stripped out and the resulting path is treated as
a URL-path. Otherwise, an external redirect is performed for
the given URL. To force an external redirect back to the
- current host, see the <code>[R]</code> flag below.</dd>
+ current host, see the <code>[R]</code> flag below.</p>
+ <p>Note that a redirect (implicit or not) using an absolute URI
+ will include the requested query-string, to prevent this see the
+ <code>[QSD]</code> flag below.</p></dd>
<dt><code>-</code> (dash)</dt>
@@ -1264,9 +1309,20 @@ cannot use <code>$N</code> in the substitution string!
<tr>
<td>B</td>
<td>Escape non-alphanumeric characters in backreferences <em>before</em>
- applying the transformation. <em><a href="../rewrite/flags.html#flag_b">details ...</a></em></td>
+ 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">
+ <td>BCTLS</td>
+ <td>Like [B], but only escape control characters and spaces.
+ <em><a href="../rewrite/flags.html#flag_bctls">details ...</a></em></td>
+ </tr>
+<tr>
+ <td>BNE</td>
+ <td>Characters of [B] or [BCTLS] which should <strong>not</strong> be escaped.
+ <em><a href="../rewrite/flags.html#flag_bne">details ...</a></em></td>
+ </tr>
+<tr class="odd">
<td>backrefnoplus|BNP</td>
<td>If backreferences are being escaped, spaces should be escaped to
%20 instead of +. Useful when the backreference will be used in the
@@ -1280,7 +1336,7 @@ cannot use <code>$N</code> in the substitution string!
<tr class="odd">
<td>cookie|CO=<em>NAME</em>:<em>VAL</em></td>
<td>Sets a cookie in the client browser. Full syntax is:
- CO=<em>NAME</em>:<em>VAL</em>:<em>domain</em>[:<em>lifetime</em>[:<em>path</em>[:<em>secure</em>[:<em>httponly</em>]]]] <em><a href="../rewrite/flags.html#flag_co">details ...</a></em>
+ CO=<em>NAME</em>:<em>VAL</em>:<em>domain</em>[:<em>lifetime</em>[:<em>path</em>[:<em>secure</em>[:<em>httponly</em>[<em>samesite</em>]]]]] <em><a href="../rewrite/flags.html#flag_co">details ...</a></em>
</td>
</tr>
<tr>
@@ -1338,7 +1394,9 @@ cannot use <code>$N</code> in the substitution string!
<tr class="odd">
<td>noescape|NE</td>
<td>Prevent mod_rewrite from applying hexcode escaping of
- special characters in the result of the rewrite. <em><a href="../rewrite/flags.html#flag_ne">details ...</a></em></td>
+ special characters in the result of rewrites that result in
+ redirection. <em>
+ <a href="../rewrite/flags.html#flag_ne">details ...</a></em></td>
</tr>
<tr>
<td>nosubreq|NS</td>
@@ -1538,8 +1596,8 @@ redirection</td>
</div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../en/mod/mod_rewrite.html" title="English">&nbsp;en&nbsp;</a> |
-<a href="../fr/mod/mod_rewrite.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a></p>
-</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
+<a href="../fr/mod/mod_rewrite.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a></p>
+</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our <a href="https://httpd.apache.org/lists.html">mailing lists</a>.</div>
<script type="text/javascript"><!--//--><![CDATA[//><!--
var comments_shortname = 'httpd';
var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html';
@@ -1557,7 +1615,7 @@ var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html
}
})(window, document);
//--><!]]></script></div><div id="footer">
-<p class="apache">Copyright 2019 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
+<p class="apache">Copyright 2024 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();