Bug 53153 - Rewrite documentation unclear or wrong about what is matched (file-path)
Summary: Rewrite documentation unclear or wrong about what is matched (file-path)
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Documentation (show other bugs)
Version: 2.5-HEAD
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: HTTP Server Documentation List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-26 16:48 UTC by Philippe Cloutier
Modified: 2015-05-09 15:56 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Cloutier 2012-04-26 16:48:33 UTC
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).
Comment 1 Rich Bowen 2015-04-14 19:21:24 UTC
Resolved (I hope) in r1673529

Comments welcome.
Comment 2 Philippe Cloutier 2015-04-15 18:53:24 UTC
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
Comment 3 Philippe Cloutier 2015-05-09 15:56:14 UTC
See ticket 57911 for a follow-up about the new phrasing.