Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

We have recently retired an online property and are redirecting all traffic to a new site

<VirtualHost *:80>
    ServerName    oldsite.co.uk
    RedirectMatch 301 (.*) http://www.newsite.co.uk$1
</VirtualHost>

This is working well but our web analytics boffin now wants to get stats on the traffic being redirected from here to there.

I've tried to get it to log the redirects using rewrite log but it doesn't seem to count RedirectMatch as a rewrite - the file rewrite.log was created but it is empty even though redirects are happening.

<VirtualHost *:80>
    ServerName    oldsite.co.uk
    RewriteLog "/var/log/httpd/sites/oldsite/rewrite.log"
    RedirectMatch 301 (.*) http://www.newsite.co.uk$1
</VirtualHost>

Can't find anything here or on Google to suggest how to make it work, so wonder if anyone can help?

Many thanks

Ian

share|improve this question

2 Answers 2

up vote 1 down vote accepted

There should be entries in the access log corresponding to those requests, given that they were answered with 301 redirects. If you're running a single giant access log for the entire server, but you want this log to be in a separate file, you can setup a separate CustomLog directive just for this vhost.

share|improve this answer

All requests, regardless of the HTTP code that was returned to the client, are recorded in the access_log. You can use a tool like http://awstats.sourceforge.net/ to analyze the requests. Just make sure that you configure it to consider 301 redirects as regular traffic, by adding 301 to the ValidHTTPCodes directive.

share|improve this answer

Your Answer

 
discard

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.