http://httpd.apache.org/docs/trunk/en/rewrite/intro.html#rewriterule contains: The Pattern is always a regular expression matched against the URL-Path of the incoming request (the part after the hostname but before any question mark indicating the beginning of a query string) or, in per-directory context, against the request's path relative to the directory for which the rule is defined. This is correct for the first RewriteRule, but not necessarily for the following rules. As explained in http://httpd.apache.org/docs/trunk/en/mod/mod_rewrite.html#rewriterule : On the first RewriteRule, it is matched against the (%-decoded) URL-path (or file-path, depending on the context) of the request. Subsequent patterns are matched against the output of the last matching RewriteRule. I suggest this formulation instead: Pattern is a regular expression. It is initially (for the first rewrite rule) matched against the URL-path of the incoming request (the part after the hostname but before any question mark indicating the beginning of a query string) or, in per-directory context, against the request's path relative to the directory for which the rule is defined. This doesn't specify what happens after the first rewrite rule, so it's incomplete, but it's just an introduction, so I think it's fine as long as it's not misleading.
I have applied your suggestion and added a note that the URL-path of the incoming request is matched in the first rewriterule or until a substitution takes place, and that rules that follow are matched against the substituted value instead. Do give it a read-through and tell me what you think of this new wording.
Thank you Daniel. The paragraph now contains: for the first rewrite rule or until a substitution occurs It would be slightly clearer to have: for the first rewrite rule and until a substitution occurs Also, in "Once a substitution has occured, the rules that follow are matched against the substituted value.", "the substituted value" is confusing since there can be several. Replacing "substituted value" with "last substitution" would clarify.
So, basically, what I'm reading is that RewriteRule is most like Perl's $_ scalar. "Once a substitution has occured, the rules that follow are matched against the substituted value." I propose: Once a substitution has occurred in the value, the rules that follow are matched against the value as it exists after the substitution has taken place.
(In reply to comment #3) > So, basically, what I'm reading is that RewriteRule is most like Perl's $_ > scalar. > > "Once a substitution has occured, the rules that follow are matched against > the substituted value." > > I propose: > > Once a substitution has occurred in the value, the rules that follow are > matched against the value as it exists after the substitution has taken > place. I think this is a step backwards
(In reply to comment #4) > (In reply to comment #3) > > So, basically, what I'm reading is that RewriteRule is most like Perl's $_ > > scalar. > > > > "Once a substitution has occured, the rules that follow are matched against > > the substituted value." > > > > I propose: > > > > Once a substitution has occurred in the value, the rules that follow are > > matched against the value as it exists after the substitution has taken > > place. > > I think this is a step backwards Why? How about: All mod_rewrite rules match against and destructively transform a single value. The value after a given transformation is the value seen and matched against by the next rule in the chain.
Hi Kyle, I can't speak for Eric, but I find this part unclear: the value as it exists after the substitution has taken place A reader may wonder "The value of what?". As for your second suggestion, I'm not sure what you're proposing exactly (how that sentence would integrate in the rest of the section), but I have no idea of what "destructively transform" would mean.
Are we trying to say something like Each rule encountered modifies the value of the required uri as you go along. So each rule gets the modified value from any previous rule. It appears that as we try to get more technically accurate we become less clear. doesn't feel like progress to me.
(In reply to comment #7) > Are we trying to say something like > > Each rule encountered modifies the value of the required uri as you go > along. So each rule gets the modified value from any previous rule. > > It appears that as we try to get more technically accurate we become less > clear. doesn't feel like progress to me. In each rule, there is a pattern, a substitution, and optionally a set of flags. The first rule's input is the URI requested by the client. For each rule, when the pattern does not match, that rule's output is its unaltered input. When it matches, the substitution/flags are applied and the substituted string is the rule's output. The output of the prior rule is the input to the next. When the rule is the final rule in the chain, its output is the final rewritten URI or URL that httpd processes. There are flags which can tell httpd not to process any rules following the flagged rule.
Guys, this ticket is marked as closed. If it's closed, please move on. If it's not fixed yet, please either reopen it, or, preferably, open a new one with a clearer statement of what problem it is that we're trying to solve. It is no longer at all clear what problem we're chasing. Thanks.
Regarding "The output of the prior rule is the input to the next.", there may be several prior rules. And the "output" of any prior rule does not necessarily exist, if no prior rule ran.