Apache 2.2
Code XML:<VirtualHost foo.localhost:80> NameVirtualHost foo.localhost DocumentRoot /Users/samsm/Sites RewriteEngine On RewriteRule ^/test_forward$ /test.php [QSA,L] ErrorDocument 404 /test_forward </VirtualHost>
In this example, test.php gets run on a 404, and kindly provided with a REDIRECT_URL server variable, accessible at $_SERVER['REDIRECT_URL']. THis is what you'd expect from http://httpd.apache.org/docs/2.2/cus....html#behavior
Great except I want to take that REDIRECT_URL and use it in the rewrite.
Like:
But that doesn't work.Code XML:RewriteEngine On RewriteRule ^/test_forward$ /%{REDIRECT_URL}/test.php [QSA,L]
Any ideas? Can you use arbitrary environment variables in rewrites? Or am I asking for something that just doesn't work?
Is there another way to intercept 404s and rewrite to another resource?
Thanks!








Bookmarks