- Error Handling
- Why Is This Important
- Customised 404 error pages
- 404 error configuration
Error handling is only relevant once broken links come into play, as described in another article in the knowledge base. Handling these errors could be the difference between losing a user and keeping one. In this article, we address how errors should be handled using custom error-404 pages.
But is should be noted that this is a blanket fail-safe measure not a preventative measure. For preventative measures refer to other articles within the knowledge base covering topics like redirects.
Once a site gets big or at least, larger than a few pages, or if a blog is installed, it becomes easier for pages to fall down, be removed, or incorrect URL’s come into play. These are easily missed and consequently broken links can start to appear causing errors and this occurs on pretty much every website on the net.
Although these can be fixed or redirected once identified it behoves a web admin to have a contingency for the almost inevitable eventuality of having error-404’s.
In addition to broken links internal to your website, you may also encounter broken links pointing to your site from other websites. These can occur if other websites link to your site and then you restructure your site or change URLs. Ideally if a URL is changed a whole range of measures should be taken to facilitate this without losing your SEO investment in a page/s.
Although not commonplace, people can enter a URL into a browser manually, if typed incorrectly this could result in the user hitting a “page not found” page. Although not the fault of the website admin, this still needs to be addressed.
Purposely enter an incorrect URL into your Internet browser using your domain to check if a customised error page appears.
The 404-error page should include the site's logo, main navigation menu and a short message as to why the page in question was not found. If it does not, the site does not have a dedicated / customised error-404 page and will likely return an error that looks like the below image:
A dedicated error-404 page should exist on the site that all broken links redirect to; this acts as a fence preventing your visitors from leaving unnecessarily. It does this by providing suggestions, and at least a webpage that looks like the rest of the website.
These pages should be themed to look like any other page on the site and offer some advice to users such as “we are sorry but the page you are looking for cannot be found, please use the menu above or click here to return to the home page”.
The below is a screenshot of the Raptor error-404 page:
Ensure that all incorrect/non-existent pages return a 404 HTTP header rather than a 302 or some other status code.
Most websites use a Linux server for hosting, and consequently in order to setup an error-404 page you will need to add some code to the .htaccess file. The code below is an example, in reality you will need to substitute the “error404.html” part with the page file name of your error-404 page:
ErrorDocument 404 /error404.html
Copy this code to the bottom of your htaccess file and upload it to the server. Be careful when implementing code into the htaccess file as this can lead to site-wide issues if not done correctly. Always test that the site works as intended after making changes.
There are a huge number of CMS (Content Management Systems) such as Magento, WordPress, Concrete 5, etc… Which means there are many ways to implement error handling depending on the server hosting your website and the interface through which it is managed.
Consequently we cannot list every possible method for implementation, but we have listed some good articles below that show you how to implement on different platforms:
Once setup, test that the error-404 page is triggered when incorrect URL’s are entered into a web browser.
Not having a custom error-404 page doesn’t prevent people from landing on a default error-404 page, which is pretty ugly and looks like, to the user, that they have left the website. Not everyone on the net is Internet savvy and so many people will leave a site, close the tab or go back to the search results.
Overall, not setting up your error handling properly can provide a poor user experience and result in lost users as a result. The impact overall is typically minimal for small to medium sized sites, but larger sites do experience error-404 problems a lot more frequently.
The solution is very easy to implement for most web admins or laymen and hence the benefit outweighs the cost massively.