Prevent Users From Seeing 404 Errors
- Prevent users from seeing 404 errors
- Keep search engines happy
- Help boost your page ranking
There are many reasons why our servers could be sending out errors. This could be due to coding bugs or migration from one CMS to another. From personal experience we migrated our website over to a new WordPress setup and there were many old pages that were getting a 404. We had to use this rule to send a nice friendly redirect back to the home page.
How Does It Work?
We check the response code from the web server and if it starts with a 4 then we will issue a redirect.
Tip: Why not expand this rule to log the name of the broken page or catch 5xx errors also…