Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I recently re-designed my site and a lot of the URLs changed. I have already setup rewrite rules in Apache to redirect old URLs to the new URLs. That's all working.

My question is, how can I get Apache to NOT log the 301 redirects?

I only log the NEW url after the redirect is done.

share|improve this question

migrated from stackoverflow.com Sep 6 '11 at 2:05

This question came from our site for professional and enthusiast programmers.

2 Answers 2

What is the reason for not wanting to log these? It really shouldn't harm anything. If it is filling up your disk partition then something is terribly wrong, and I'd look into how you can deal with that.

If it's just because you don't want to see these requests in your reports, then the appropriate way to go about that is to configure your reporting software just to ignore those requests. Many log analysers would already have a feature to do this, or may already be configured to report them differently.

That way, you still have the data if you need it (it may come in useful, for example when seeing how many people are still using the old URL) in the future.

share|improve this answer

You could possibly do conditional logging. You should be able use your rewrite rules to add the environment variable.

Do note, as mentioned at the link, that depending on exactly why you want to do this, it may be easier to just ignore the 301 entries during post-processing.

share|improve this answer

Your Answer

 
discard

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