NOTE: following code is surrounded by a RewriteCond/RewriteRule that skips the cases so they do not get ran again after the redirect takes place.
Why can’t I get this to test true?
RewriteCond %{REQUEST_FILENAME} ="/unique/test/test"
RewriteRule ^.*$ /match [R=301,L]
I’m outputing everything with the following line and I can clearly see what REQUEST_FILENAME is:
RewriteRule (.*) /test$1-filename-%{REQUEST_FILENAME}-URI-%{REQUEST_URI} [R=301,L]
but I can’t get it to match.
I was originally trying to do something like this to test if had modified the path from the original URI or not, but seeing as I cannot get the above to test true, this certainly does not work:
RewriteCond %{REQUEST_FILENAME} =%{REQUEST_URI}
In
RewriteCond, variables are only expanded within the first argument. So with yourRewriteCondyou are actually comparing the value of REQUEST_FILENAME with the literal string%{REQUEST_URI}.To do what you intended, you need to do some trick: