You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by el...@apache.org on 2019/02/12 08:05:53 UTC

svn commit: r1853417 - /httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml

Author: elukey
Date: Tue Feb 12 08:05:53 2019
New Revision: 1853417

URL: http://svn.apache.org/viewvc?rev=1853417&view=rev
Log:
mod_rewrite.xml: add an example about override behavior

A user in PR 63051 was confused about the default behavior
of mod_rewrite (override) when merging two sections in the
directory context at the same nesting level. I was confused
as well, but after a quick look at the code I figured out that
RewriteOptions Inherit seems to solve the issue (naming is,
in this case, a bit counter intuitive).


Modified:
    httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml

Modified: httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml?rev=1853417&r1=1853416&r2=1853417&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/mod/mod_rewrite.xml Tue Feb 12 08:05:53 2019
@@ -1134,7 +1134,35 @@ type="section" module="core">Files</dire
 (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 <directive module="core">If</directive> 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 <directive
+module="rewrite">RewriteOptions</directive> directive can change this behavior,
+for example using the <em>Inherit</em> setting.</li>
+
+<li>The <directive module="rewrite">RewriteOptions</directive> 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 
+<directive module="core">If</directive> block
+are considered, since the first ones are overridden. Using <directive
+module="rewrite">RewriteOptions</directive> Inherit forces mod_rewrite to merge the two
+sections and consider both set of statements, rather than only the last one.</li>
 </ul>
+<example>
+<highlight language="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;
+</highlight>
+</example>
 </note>
 
       <p>For some hints on <glossary ref="regex">regular