Meaning of RewriteRules in adjacent <If> sections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some comments and a question about the manual's discussion
of RewriteRules in immediately adjacent <If> sections.

In mod_rewrite.html (https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html),
the section "Per-directory Rewrites" includes these notes with example:

==========
• 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>
==========

Comment #1: in the text, the three occurrences of "RewriteOptions"
are linked to an incorrect URL
( https://httpd.apache.org/docs/2.4/mod/rewrite.html#rewriteoptions
instead of
https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewriteoptions ).

Very minor comment #2: The text says "the RewriteRules stated in the second If block"
and "the first ones", but there's only _one_ RewriteRule in each If block.

Question: in the example, despite the wording "stated at the same
nesting level of the configuration", are the two <If> sections supposed to be
embedded in _separate_ (.htaccess or <Directory>) contexts, rather
than being immediately adjacent?

The text seems rather to imply that the description/example is supposed to be as it is,
but then the behaviour described is somewhat "counter-intuitive", i.e., I don't see how
I could have deduced it from the descriptions of RewriteOptions and <If>.
The description of RewriteOptions Inherit at
https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewriteoptions
does explicitly mention the case of per-directory context, and then
only talks about merging rules from the _parent_ context, not from
_sibling_ contexts.

Richard.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux