http://httpd.apache.org/docs/trunk/en/mod/mod_rewrite.html#rewriterule says: Pattern is a perl compatible regular expression. On the first RewriteRule, it is matched against the (%-decoded) URL-path (or file-path, depending on the context) of the request. I think the second parenthesis is wrong, or at least unclear. To put it simply: What is the file-path of a request? file-path is defined as: The path to a file in the local file-system beginning with the root directory as in /usr/local/apache/htdocs/path/to/file.html. Unless otherwise specified, a file-path which does not begin with a slash will be treated as relative to the ServerRoot. Just below the problematic sentence, a box expands on what is matched: In Directory and htaccess context, the Pattern will initially be matched against the filesystem path, after removing the prefix that led the server to the current RewriteRule (e.g. "app1/index.html" or "index.html" depending on where the directives are defined). I find this less bad, although one may ask *which* filesystem path this refers to. The parenthesis was added recently (see #52000 for background).
Resolved (I hope) in r1673529 Comments welcome.
Thank you Rich. Just to be clear, I have changed job since I filed this and haven't had to use mod_rewrite in 3 years, so I'm even less clear on what the documentation should read. On the other hand, I suppose my reading now resembles more that of the typical reader. The sentence now reads: On the first RewriteRule, it is matched against the (%-decoded) URL-path of the request, or, in per-directory context (see below), the URL path relative to that per-directory context. I do not find "the URL path relative to that per-directory context" much clear. If "URL path" means "URL-path", the documentation says URL-path is "A DocumentRoot-relative path", so this seems to contradict. In https://bz.apache.org/bugzilla/show_bug.cgi?id=52000#c11 I suggested "the request's path relative to the directory for which the rule is defined" but I don't know if this is clear. I would suggest "the part of URL-path following the path to the directory for which the rule is defined". By the way, in the sentence before, "perl compatible regular expression" could be replaced with "regex", defined in http://httpd.apache.org/docs/trunk/en/mod/directive-dict.html#Syntax
See ticket 57911 for a follow-up about the new phrasing.