Configuring Apache to log referrer url

Manix asked:

I’m trying to make Apache server log the referrer URL in all requests including 404 and 200

for example

someone has embedded an image hosted on my websites on his own website. the image is loaded using CSS. I want my Apache server to log where the image is loaded. on which URL. and also if the image deleted from my website, it should still log the request

Currently my Apache server combined log format is

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\"" combined

My answer:


Now you only need to configure your virtual host to actually log something.

For example:

<VirtualHost *:443>
#...other stuff
    CustomLog logs/access.log combined
#...other stuff
</VirtualHost>

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.