https://issues.apache.org/bugzilla/show_bug.cgi?id=46376

           Summary: %{REQUEST_FILENAME} does not hold full local filesystem
                    path to the file or script matching the request
           Product: Apache httpd-2
           Version: 2.2-HEAD
          Platform: PC
               URL: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#re
                    writecond
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Documentation
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


In the section RewriteCond Directive, it says:

REQUEST_FILENAME
    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

http://www.google.com/?test=/images/hotelphotos1/14032.jpg

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

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f

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.

Regards.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to