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:
It's easy to install and use. It's also free.
It works with a lot of themes.
It allows us to log the HTTP 404 errors. This allows us to analyze these links later and fix them.
It can notify us whenever such errors are logged via email.
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.
Obviously we are using Wordpress, so we assume you have a working installation of Wordpress. It can either be hosted locally or remotely. In our example here we use a local installation with Wamp Server.
Your Apache server must have rewrite_module enabled (See below).
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:
With your server up and running, click the wamp server icon in the taskbar of your desktop.
From the menu that pops up hover your cursor over Apache.
Another menu pops up. Hover the cursor over Apache modules.
Another menu pops up with a long alphabetical list of modules for our server.
Scroll over to rewrite_module.
If it's not checked then check it. This will enable it.
The server will restart automatically. That's it, we have enabled our rewrite_module in our Apache Server.
Click 'Settings' as show in the below image.
HP_NO_IMG/data/uploads/users/a4c0adcd-8650-4b65-9b01-9dd628e70757/521306019.png" alt="Click Setting" />
Our Redirect type is 301 Redirect. It's selected by default.
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.
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.
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.
Finally you can exclude paths you wouldn't want being redirected.
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.
Looking for the right web hosting solution for your website can be an intimidating task. Options nowadays are more diversified than ever, and each year brings new developments in the web hosting market. If you have no clue of what to look out for, you can find yourself overwhelmed with...
Content marketing continues to be one of the most valuable tools for today’s online businesses. With content, you can improve your chances of reaching your target audience, boost your search engine standing, and even unlock new opportunities for sales. The more content you produce, the more you can strengthen your...
User Experience (UX) is one of the most crucial factors to consider in web design. As the number of websites and applications in the world today continues to accelerate, businesses are under more pressure than ever to impress customers straight away. If a user visits your website and finds slow-loading...