Apply SetEnvIf after Apache RewriteRule
Posted
by
coneybeare
on Server Fault
See other posts from Server Fault
or by coneybeare
Published on 2012-04-06T17:01:09Z
Indexed on
2012/04/06
17:32 UTC
Read the original article
Hit count: 252
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
SetEnvIf
s:
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?
© Server Fault or respective owner