From: Luca Toscano Date: Sat, 9 Feb 2019 14:14:43 +0000 (+0000) Subject: mod_rewrite.xml: add an example about override behavior X-Git-Tag: 2.5.0-alpha2-ci-test-only~2169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0191ebe90bcf39836a5a800a6ec483fa868ddef4;p=thirdparty%2Fapache%2Fhttpd.git 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). I hope that I added a good clarification in the code, if not please amend it as you think it's best! git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1853280 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml index 28b7799ae7d..c3816eb149d 100644 --- a/docs/manual/mod/mod_rewrite.xml +++ b/docs/manual/mod/mod_rewrite.xml @@ -1141,7 +1141,35 @@ type="section" module="core">Files sections (including their regular expression counterparts), this should never be necessary and is unsupported. A likely feature to break in these contexts is relative substitutions. + +
  • The If blocks +follow the rules of the directory context.
  • + +
  • By default, mod_rewrite overrides rules when +merging sections belonging to the same context. The RewriteOptions directive can change this behavior, +for example using the Inherit setting.
  • + +
  • The RewriteOptions 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 +If block +are considered, since the first ones are overridden. Using RewriteOptions Inherit forces mod_rewrite to merge the two +sections and consider both set of statements, rather than only the last one.
  • + + +<If "true"> + # 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] +</If> +<If "true"> + RewriteRule bar http://example.com/bar [R] +</If> + +

    For some hints on regular