Bug 46376

Summary: %{REQUEST_FILENAME} does not hold full local filesystem path to the file or script matching the request
Product: Apache httpd-2 Reporter: Romain GALLET <romain.gallet>
Component: DocumentationAssignee: HTTP Server Documentation List <docs>
Severity: normal    
Priority: P3    
Version: 2.2-HEAD   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
URL: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond

Description Romain GALLET 2008-12-10 07:54:49 UTC
In the section RewriteCond Directive, it says:

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

However, this variable seems to hold only the part on the URL after the hostname. Example, in

- http://localhost/images/hotelphotos1/14032.jpg

According to the documentation, with a DocumentRoot of "/var/www/html", you would expect %{REQUEST_FILENAME} to be

- /var/www/html/images/hotelphotos1/14032.jpg

But it really is just:

- /images/hotelphotos1/14032.jpg

How to prove/reproduce:
- Apache 2.2.10 (ArchLinux official package)
- In the vhost config, I have one and only one rule:
  RewriteRule (.*) http://www.google.com/?test=%{REQUEST_FILENAME} [L]

Using the URL http://localhost/images/hotelphotos1/14032.jpg, I get


which shows that %{REQUEST_FILENAME} is NOT the full local filesystem path to 14032.jpg.

This is an issue because RewriteCond testing for the presence of a file, ie RewriteCond %{REQUEST_FILENAME} -f will always return False.

It can be circumvented using


I could reproduce this bug/behavior on CentOS5 and the latest Apache2 rpm.

To be, this behavoir makes sense. It'd rather need a change in the documentation for that feature.

Comment 1 Bob Ionescu 2008-12-11 05:14:05 UTC

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