25th May, 2017 | Tutorials |

WordPress – Smart Handling of 404 Errors To Improve SEO

Using Wordpress? Get our lightening fast Wordpress Optimised Hosting.

Get Wordpress Hosting

Have you ever clicked on a link on a site only to end up with a page like this:

HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/1356165126.png" alt="'Choose Plugin Settings'" />

It's annoying isn't it? Well "404 page not found" is one of the most common errors on the web. They are almost impossible to avoid as a site owner especially if you have lots of posts. HTTP 404 errors are raised when the client, that is the browser, is able to communicate with the server, although it's not able to retrieve the resource or page that was requested by the user. It may also be raised as a result of a broken or dead link. 404 errors will hurt your SEO.

It's therefore vital you manage them and that's the purpose of this tutorial. While search engine bots are crawling your site, you wouldn't want them finding well-formatted URLs that lead to a 'Page Not Found'. Plenty of HTTP 404 errors can therefore hurt your site's credibility and ranking.

Moreover, a busy user visiting your site only to encounter an error would leave and never come back. This then leads to a higher bounce rate, something we try to avoid by investing a lot of hours producing quality content. A user who is able to visit a couple of pages in your site is likely to come back or even bookmark your site.

It therefore makes sense we handle these errors properly. Luckily, we are using Wordpress, a popular Content Management System with thousands of professional plugins. Never mind most of them being free and open source. Yes, I mean free as in free. A search for '404' in the wordpress plugins portal gives a long paged list of plugins. You can use any. However today we shall only pick the first one: 404 to 301 plugin. Why? Because:

  1. It's easy to install and use. It's also free.
  2. It works with a lot of themes.
  3. It allows us to log the HTTP 404 errors. This allows us to analyze these links later and fix them.
  4. It can notify us whenever such errors are logged via email.
  5. Hey, and as a bonus it ranks first when you make a '404' search in wordpress plugins portal. Futhermore it has been rated five star by over 80 folks.


Enabling Apache Rewrite_Module

It's important we enable the rewrite_module in our server so that our redirects work appropriately. If you are using a local wordpress installation with wamp server it's very easy:

  1. With your server up and running, click the wamp server icon in the taskbar of your desktop.
  2. From the menu that pops up hover your cursor over Apache.
  3. Another menu pops up. Hover the cursor over Apache modules.
  4. Another menu pops up with a long alphabetical list of modules for our server.
  5. Scroll over to rewrite_module.
  6. If it's not checked then check it. This will enable it.
  7. The server will restart automatically. That's it, we have enabled our rewrite_module in our Apache Server.

HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/590416496.png" alt="Enabling Apache Rewrite_Module" />

If you are on a shared host then you may need to contact your host's support to do it for you. Most hosts should probably have it enabled already.


We are using the '401 to 301' plugin. Its free. Here's how to install it:

  1. Go to the 'Add New' in the Plugins Section in your admin panel.
  2. Search '404 to 301' in the plugins search form. This requires internet connection.
  3. Click 'Install Now' to install it.
  4. Click 'Activate' to activate our plugin.

HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/1420052147.png" alt="Install Plugin" />


We now need to configure our plugin:

  1. Click 'Settings' as show in the below image. HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/521306019.png" alt="Click Setting" />
  2. Our Redirect type is 301 Redirect. It's selected by default.
  3. Redirect to the Custom Page you want. Otherwise it will redirect to the homepage by default. You can create a page you can redirect to.
  4. If you prefer to log errors, select 'Enable Error Logs' in the dropdown. *If you have a lot of 404 errors being logged, you would want to fix the cause. This is because having thousands of errors being logged is I/O intensive to your server. Am sure your host probably provides a limited I/O capability like most other hosts. Too much logging can make your site slow.
  5. If you want to receive notifications via email, tick the checkbox and enter your email address. You'll get an email every time a 404 error is logged and a redirect to your custom page occurs.
  6. Finally you can exclude paths you wouldn't want being redirected.

HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/1410958160.png" alt="Settings Page" />


The reality is that everybody would like to have a better search engine ranking. It's why we work hard as site owners, designers and developers to optimize our sites. However, sometimes what we really need to do is very simple: provide a great user experience. Hence it's imperative that we properly handle the 404 errors. We don't have to get our hands dirty with code. There are already many plugins that can assist us. As long as the plugin can meet our expectations. Such plugin is '404 to 301' that we used here. The choice is always yours, so you can use any that works for you. But first we need to make sure we have the rewrite_module enabled in our Apache Server. It's easy to do but you must have the permission to tinker with your server's settings. In a shared host, if it's not enabled you may need to contact your host's support. However in a localhost like the WAMP Server we used, it's pretty easy. Our plugin in this tutorial can enable us log errors as well as send email notifications. At the end of the day handling our 404 errors smartly is not difficult and we ensure smooth user experience as well as improving our search engine ranking. Our users end up happy. The search engine ends up happy. And so do we.

Using Wordpress? Get our lightening fast Wordpress Optimised Hosting.

Get Wordpress Hosting