httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Morrissey <>
Subject [users@httpd] Apache2: mod_rewrite and %{REQUEST_FILENAME}
Date Mon, 20 Jan 2003 17:31:15 GMT
I'm running Apache2 (2.0.43) and wanted to transparently send requests for
PHP-processed files to an Apache1.3 instance, which runs PHP Accelerator
( Naturally, I turned to mod_proxy and
mod_rewrite. However, I (think I've) found a problem with the docs or with
mod_rewrite itself. Here's the ruleset I tried:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} \.php$
RewriteRule ^/+(.*)$$1 [P,NE,L]

Turning on a RewriteLog showed that %{REQUEST_FILENAME} contained the URI of
the request, not the full local path as stated in the mod_rewrite docs
( After judicious
cursing and hair-pulling, I found that this ruleset works:

RewriteEngine on
RewriteCond %{LA-U:REQUEST_FILENAME} \.php$
RewriteRule ^/+(.*)$$1 [P,NE,L]

In order to get the full local path in %{REQUEST_FILENAME}, you have to
force mod_rewrite to do a look-ahead with %{LA-U:REQUEST_FILENAME}.

The kicker is that the docs go on at length about the difference between
REQUEST_URI and REQUEST_FILENAME. I found these variables to be identical
unless you force mod_rewrite to look ahead for REQUEST_FILENAME. Is this a
bug in the docs, mod_rewrite, or am I just blowing hot air?

John Morrissey          _o            /\         ----  __o        _-< \_          /  \       ----  <  \,    __(_)/_(_)________/    \_______(_) /_(_)__

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message