Mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Morrissey <...@horde.net>
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
(www.php-accelerator.co.uk). 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 ^/+(.*)$ http://otherhost.horde.net/$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
(http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html). After judicious
cursing and hair-pulling, I found that this ruleset works:

RewriteEngine on
RewriteCond %{LA-U:REQUEST_FILENAME} \.php$
RewriteRule ^/+(.*)$ http://otherhost.horde.net/$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?

thanks!
john
-- 
John Morrissey          _o            /\         ----  __o
jwm@horde.net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__

---------------------------------------------------------------------
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


Mime
View raw message