Apply SetEnvIf after Apache RewriteRule
- by coneybeare
I have a working apache rewrite rule:
RewriteCond %{HTTP_HOST} ^.*foo.com
RewriteRule (.*) http://bar.com$1 [R=301,QSA,L]
and some working dontlog SetEnvIfs:
SetEnvIf Request_URI "^/server-status$" dontlog
SetEnvIf Request_URI "^/home/ping$" dontlog
SetEnvIf Request_URI "^/haproxy-status$" dontlog
SetEnvIf User-Agent ".*internal dummy connection.*" dontlog
CustomLog /var/log/apache2/access.log combined env=!dontlog
but I can't figure out how to stop the RewriteRule from logging a duplicate line. foo.com and bar.com are both on the same machine. I would expect this rule to work, but it did not:
SetEnvIf Host "foo.com" dontlog
I still get duplicates in the Apache Log:
10.250.18.97 - - [06/Apr/2012:16:57:12 +0000] "GET / HTTP/1.1" 200 732 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3"
68.194.30.42 - - [06/Apr/2012:16:57:12 +0000] "GET / HTTP/1.1" 200 732 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3"
.... where 10.250.18.97 is the server's IP. How can I prevent that RewriteRule from logging?