Doing the 404 Two Step

Dead end
DeaPeaJay via Flickr

Broken links and dead ends on your website are bad form. They cost you potential customers, erode a little trust and, if left unattended, can tweak search engines enough to downgrade your site a bit.

Hey I’m not scolding, this is one of those thankless little tasks that I’m just a guilty as the next for ignoring. Of course a thorough designer/programmer will check these out and make sure that your site doesn’t have any broken links, but if you’re like me, once you start tinkering and changing things over time, some loose ends seem to occur.

There are two things that you should do to a) reduce the chance for broken links and b) make the experience a little less harsh when they do occur.

1) Get yourself to the Google Webmaster Central and register your site so you can use the tools – specifically in this case, the broken links tool. Google shows pages that aren’t finding and helps you track down broken links and dead ends. You’ll also get some other great suggestions like pages with missing tittle tags. This is a must place to hang out!

2) Create a custom 404 page – this is the error page that you get when someone tries to visit a broken link. This page is also shown when someone just mistypes a URL to your site as well. The standard issue error page says something like – the page you are looking for can’t be found. That’s not very helpful really, now is it. Instead your page should offer some suggestions such as a search tool, list of most visited links and maybe even an HTML sitemap so they can find what they are looking for.

Most Wordspress themes these days have a 404 page as part of the theme template and it’s pretty simple to edit this with a little more user friendly content. You might also check out 8 WordPress 404 Error Plugins.

You can see a very simple example of my custom 404 here

The simplest way to create a custom error or 404 page on a static website is through the .htaccess file – this is a file that is used to give the server lots of commands and it can be edited as a text file. To create a custom error page you must first create the html page you want people to see – something like custom404.html and fill it with things like a search box, popular links and even a s link to your HTML sitemap (One note, any links that you add to this page should be full link and not relative links like /custom404.html as errors come from somewhere other than your root, like a CGI bin, and you don’t want to confuse the server.)

The next step is to add this line to the .htaccess file – ErrorDocument 404 /custom404.html – this tells the server to show this page whenever there is an error.

Simple stuff, but just a bit of necessary maintenance.


404 pages

You may also like