I have several RewriteRules in an Apache VirtualHost configuration. I'd like to be able to test the current URL (after the preceeding rewrites) against some condition. The problem is that the variable %REQUEST_URI is set at the beginning of processing and doesn't change after every rule. There is very little documentation on those variables; is there is some way to use RewriteCond to test against the current URL?
I've enabled the rewrite log and it's apparent that even after the first RewriteRule is matched and re-written, %REQUEST_URI is still set to '/'
#Map '/' and '' to '/home'
RewriteRule ^/?$ /home
#Check for cached page
RewriteCond %{DOCUMENT_ROOT}/system/cache%{REQUEST_URI}.html -f
RewriteRule ^(.+)$ /system/cache/$1.html [QSA,L]
Is there any simple way to accomplish this?
Edit: Here is an excerpt from the RewriteLog, I don't think an internal sub-request is happening.
(3) applying pattern '^/?$' to uri '/'
(2) rewrite '/' -> '/home'
(3) applying pattern '^([^.]+)$' to uri '/home'
(4) RewriteCond: input='/var/www/vhosts/example.com/subdomains/demo/rails/public/system/cache/.html' pattern='-f' => not-matched
(3) applying pattern '^.*$' to uri '/home'
(4) RewriteCond: input='/var/www/vhosts/example.com/subdomains/demo/rails/public/system/maintenance.html' pattern='-f' => not-matched
(3) applying pattern '^/(.*)$' to uri '/home'
(4) RewriteCond: input='/home' pattern='!-f' => matched
(2) rewrite '/home' -> 'http://127.0.0.1:8100/home'
(2) forcing proxy-throughput with http://127.0.0.1:8100/home
(1) go-ahead with proxy request proxy:http://127.0.0.1:8100/home [OK]