https://bz.apache.org/bugzilla/show_bug.cgi?id=70061

            Bug ID: 70061
           Summary: RewriteRule Directive: "!" (no match) modifier
                    confused with Pattern
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: All
               URL: https://httpd.apache.org/docs/trunk/en/mod/mod_rewrite
                    .html#rewriterule
                OS: All
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: Documentation
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

The documentation of the RewriteRule directive specifies the Syntax as follows:
> RewriteRule Pattern Substitution [flags]
Pattern is then specified as a PCRE regex.

But when the second argument starts with an exclamation mark ("!"), it is
interpreted as a modifier, so that the rule triggers when the pattern does
*not* match:
https://github.com/apache/httpd/blob/cfb8882f04b1c986656f6b19c487ab27810071b9/modules/mappers/mod_rewrite.c#L4029-L4035

There is some confusion because some think the character is included in the
pattern. Therefore, the remainder of the section assumes there is a match:
> $0 refers to the entire string matched by the Pattern, while $1..$9 refer to 
> the corresponding captured groups from the matched Pattern.
In fact, all back-references to the first argument are (obviously) only
available when the pattern has as least 1 match.

The patch for issue #70024 (mostly) fixes that (and more), but does not address
the issue in RewriteCond (which assumes matches of both Pattern and
CondPattern).

🅭🄍: https://www.philippecloutier.com/Common+infrastructure+licensing#its

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to