Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this configuration ...

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

SetEnvIf Request_URI "^/MyUrl1/*" p_myurl1
CustomLog /var/log/apache2/myurl1_access.log common env=p_myurl1
SetEnvIf Request_URI "^/MyUrl2/*" p_myurl2
CustomLog /var/log/apache2/myurl2_access.log common env=p_myurl2

But when the url ... is typed, I want this logged to myurl2_access.log but it logs to access.log. Why?

share|improve this question

I think that you regexp should look like this: "^/MyUrl2/.*$" instead of this: "^/MyUrl2/*"

share|improve this answer
I'd leave out the $ - there's no need to specify that it should match until the end of the string. Otherwise I agree. – Jenny D Feb 13 '13 at 9:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.