Bug 45280 - REQUEST_FILENAME is not full local filesystem path
Summary: REQUEST_FILENAME is not full local filesystem path
Status: RESOLVED DUPLICATE of bug 16402
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_rewrite (show other bugs)
Version: 2.2.8
Hardware: PC Windows Vista
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-25 14:05 UTC by Edwin Martin
Modified: 2008-12-14 05:38 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Edwin Martin 2008-06-25 14:05:38 UTC
According to the documentation on http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html, the variable REQUEST_FILENAME is the full local filesystem path:

"REQUEST_FILENAME 
The full local filesystem path to the file or script matching the request."

This seems not to be the case.

It seems the variable should be prefixed with DOCUMENT_ROOT to get the full path.

Examples:
This does not trigger the rule:
RewriteCond %{REQUEST_FILENAME} -s

But this does:
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -s

Please update the documentation or the implementation.

I lost several hours over this and I guess I'm not the only one.
Comment 1 Bob Ionescu 2008-08-14 02:56:18 UTC
The value of REQUEST_FILENAME depends upon context. It contains the full physical path only, if the request has already been mapped to the file system (-> directory context). That's not the case if you're using mod_rewrite in per-server context – you're still on uri-level. The full physical path is simply unknown in this state of processing.
To get the full physical path in server-context, you'll need an internal sub-request (%LA-U or %LA-F). Prefixing with document_root is not a solution, because this may not be the physical path at the end (think about aliases, mod_userdir etc.).

May be the docs should state that more clearly, but not the quoted 1.3 ones.
Comment 2 Bob Ionescu 2008-12-14 05:38:52 UTC

*** This bug has been marked as a duplicate of bug 16402 ***