You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Millaway, John" <Jo...@ghrsystems.com> on 2003/10/13 17:17:51 UTC

[users@httpd] Is mod_rewrite REQUEST_FILENAME a full path or relative to docume nt root?

Hi,

The docs for RewriteCond say REQUEST_FILENAME is, "the full local filesystem
path to the file or script matching the request." However, according to the
mod_rewrite logs, REQUEST_FILENAME is relative to the document root.  To
make it more confusing, some examples in the rewrite guide use filesystem
tests (-f and -d) on REQUEST_FILENAME by itself, while other examples prefix
REQUEST_FILENAME with an absolute physical. Is REQUEST_FILENAME a full
filesystem path or not?

Various snippets from the rewrite guide:

    RewriteCond    %{REQUEST_FILENAME}  -d
    RewriteCond    /your/docroot/dir1/%{REQUEST_FILENAME}  -f
    RewriteCond    /your/docroot/%{REQUEST_FILENAME} !-f
    RewriteCond   %{REQUEST_FILENAME}   !-f
    RewriteCond   %{REQUEST_FILENAME}   !-s

-John

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Is mod_rewrite REQUEST_FILENAME a full path or relative to docume nt root?

Posted by Joshua Slive <jo...@slive.ca>.
On Mon, 13 Oct 2003, Millaway, John wrote:
> The docs for RewriteCond say REQUEST_FILENAME is, "the full local filesystem
> path to the file or script matching the request." However, according to the
> mod_rewrite logs, REQUEST_FILENAME is relative to the document root.  To
> make it more confusing, some examples in the rewrite guide use filesystem
> tests (-f and -d) on REQUEST_FILENAME by itself, while other examples prefix
> REQUEST_FILENAME with an absolute physical. Is REQUEST_FILENAME a full
> filesystem path or not?

I'm not an expert on this, but I'd guess it has to do with the difference
between the per-directory and server-wide context.  I bet you get one
result when you put rewrite rules in the global server-wide context, and
another when you put them inside a <Directory> or in an .htaccess files.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org