Blog Maintenance – Check For 404 Page Not Found Errors

Trying to practice what I preach, I finally got some time to check my site statistics this month for my main site and noticed that my 404 Page Not Found Errors stats were really high. In fact, I had over 400 visits to dead links on my site.

These are internal links, not external. These are links from one post or graphic on my site to another post or file on my site, not on another site. Over 400 404 Page Not Found Errors in less than a month is a big warning signal that I obviously hadn’t been paying attention to. What this really means is that when people clicked on a link on my site, it took them to a dead end. Ugh.

How To Check for 404 Page Not Found Errors

There are two ways to check for 404 Page Not Found Errors on your WordPress blog. The first is by checking each and every page for errors, which usually helps you find errors to external links, but can help you find internal errors, too.

The other is by checking your visitor/traffic statistics via a WordPress Plugin for site statistics or your host server’s site logs for visitor and traffic statistics. Usually you can find 404 Page Not Found Errors in the Site Statistics Report under Pages Not Found or HTTP Status codes and look for 404.

Not all 404 Page Not Found Errors are your fault. Incoming links to your site or hand typed links may have screwed something up, so there is little you can do about that. The key to finding the truly errored links is to check the frequency of those 404 errors.

If the link to the post or graphic occurs once, then it could be that it was a user error and something you can’t fix. But if it happens 10, 20, or 200 times, then the odds are that the error is your fault and you need to fix it.

Tracking Down 404 Page Not Found Errors

Once you check the 404 Page Not Found Errors list, it’s time to play a little Sherlock Holmes link detective to track down the errors. At the least, you will have a link to the post or file not found. At the most, you will have that and the post where the error link originated.

Occassionally the error will be found in a post in a link that connects one post to another. If you have the source post for the dead link, edit that post to correct the faulty link. If you do not have the source post for the dead link, only the 404 Page Error for the link, then you have to do more searching to find any reference to that bad link.

Begin by searching for the link or some text in the link like the post title in your Manage Posts panel. Open each resulting post to check for that bad link reference and fix it if you find it. If you have trouble finding it through the search function in Manage Posts, then search via the search directly on your blog using any keywords or title referenced in the link.

More often, the 404 error is not in the content of a post but is in the template files or in the WordPress Links Manager. Most blogs feature links in the sidebar and footer that are consistent throughout the blog. If a link gets a lot of 404 hits, and it looks familiar, then the odds are that you need to find which template file or link in Link Manager holds the bad link in order to fix it.

This is a fairly easy process since errors in the sidebar are usually found in the sidebar.php template file and errors in the footer are found in the footer.php template file. If you have links created with WordPress Links Manager, then access it through your Administration Panels to correct those links.

Graphics Not Found

Dead end links to graphics happen often because of a problem with the absolute versus relative link to the graphic, or the irregular use of capital letters. I have recurring problems with some photographs on my site that use capital letters like SallySmithPhoto.jpg and I forget they are capitalized and type sallysmithphoto.jpg. Your browser may think these are two different graphics. Look very closely at how you spell and capitalize the link to the graphic.

Another common 404 error link is found with graphics in your style sheet. Almost all WordPress Themes and website styles sheets feature graphics as icons, bullets, backgrounds, and other graphic features. If you are using absolute links to these graphics, there is little doubt that they will find their source, but if you are using relative links, they might miss the target.

And absolute link to a graphic on your blog might be something like this:

If graphics in your style sheet are found in the same folder as your WordPress Theme, then the reference to the graphic should be:

background:url(backgrnd.jpg)

If the graphic is in a subfolder from your Theme folder, make sure the link is something like this:

background:url(graphics/backgrnd.jpg)

If the graphic is in a totally different folder, then ensure its appearance on your site by either linking directly to the graphic with an absolute link or using the root directory reference with a slash in front of the link such as:

background:url(/images/backgrounds/backgrnd.jpg)

The Mysteries of the Suddenly Missing Links

Maybe it’s a slip of the fingers, maybe it’s just a gremlin, but I swear that I check and triple check all links from my template files, Links Manager, and style sheet thoroughly when developing and designing my blogs. Yet a couple months later I will check and sure enough the graphic for the list bullets is suddenly a black dot and not the pretty blue ball graphic I wanted.

A check of my 404 Page Not Found Errors will show that for some reason the link in my style sheet to that particular list bullet is now missing the slash in front that I was sure was there before. I slap my forehead and fix it, grumbling at the missing link.

Other things can happen to screw your links up. If you are using Permalinks with dates and you link to a post from another post, and later change that linked post to another date, the link between the two posts can be broken. Watch out for that, though WordPress tends to automatically catch these more often than not.

If you set your graphics in a specific folder, and move the graphic to a different folder, or even get more drastic and move the folder, all links to those images will be broken.

You might not notice the problem at first, but it will appear in your blog statistic logs in time as 404 errors.

However your missing links break, make it a part of your regularly scheduled blog maintenance to check for those dead links. Your users will be much happier when they click a link and it actually works.

With WordPress.com, use some of those resources, like Firefox Web Developer Extension > Validate Links, to run your posts through a link checker. You can choose to test the whole site or at least X number of web pages within the site, or individual pages.

The problem with WordPress.com is that it’s hard to find out if anyone is getting 404 errors from anything. The Referers panel sorta helps but not in a thorough and easy to use manner. So your best bet is to assume that like the rest of us web masters and administrators, there will be dead end links over time. It’s just what happens, whether those links are internal or external.

Running the site through to check for dead links and 404 errors on a regular basis, as explained in Blog Maintenance and Cleaning, will help keep you on top of those possible errors. They will happen, so expect them and work with prevention and frequent checking.