views:

21

answers:

1

Hi. I'm trying to set up a simple rule in my httpd.conf as a precursor to some more complex rules I need to set up.

If I use this:

RewriteCond %{REQUEST_URI} ^/test\.txt
RewriteRule ^(.*)$ http://127.0.0.1:8080 [R,L]

... then a request for /test.txt goes to port 8080, as expected.

But if I add a ! to flip the REQUEST_URI match, like this:

RewriteCond %{REQUEST_URI} !^/test\.txt
RewriteRule ^(.*)$ http://127.0.0.1:8080 [R,L]

... then every request gets sent to port 8080, including requests for /test.txt. I was expecting text.txt to be allowed through because the RewriteCond would be applying the following rule to every request that doesn't match /text.txt.

What stupid, simple mistake am I making here? I Googled until I got dizzy.

A: 

This problem appears to be a result of other configuration settings on the machine in question, as the rules are working fine on a vanilla Apache install.

Nick