Apache - How to NOT log 301 redirects
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.
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.
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.
Comments
Post a Comment