Apache - How to NOT log 301 redirects

Apache - How to NOT log 301 redirects - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Apache - How to NOT log 301 redirects error on your web browser. Problem :


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.


Solution :

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.


We hope that this article has helped you resolve the redirects, apache, logging error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How do I redirect traffic only if being accessed from a specific port?

DNS entry to redirect constant url to changing directory name

How to redirect to any domain [duplicate]