The dreaded 404 page can be a huge headache for anyone who manages a website. And sometimes figuring out how to handle such errors when using a CMS such as WordPress can be even more challenging. WordPress has default settings for handling 404 errors, but they leave a lot to be desired. So how does one go about making improvements to that standard handling? And more importantly, how do you prevent 404 errors in the first place?
This is a quick guide to 404 errors in WordPress. It includes information on why they happen, why they’re such a big deal, how to prevent them, and more. We’ve included a number of plugins that make handling WP 404 errors nearly painless and a selection of additional resources at the end. Handling your 404 errors should be a breeze after reading this.
On a side note, we’d also like to show several showcases of Creative Error 404 Pages we’ve previously published:
- Nice And Creative Error 404 Pages, Part I
- Nice And Creative Error 404 Pages, Part II
- Nice And Creative Error 404 Pages, Part III
What Causes Error 404 Pages in WordPress?
404 pages in WordPress are most often caused because of a change in the permalink structure of the site. If a site owner changes the permalink structure of their WP blog, they’re likely going to end up with incoming links pointing to pages that are no longer located at a particular address. This means those incoming visitors will be given a 404 page instead of the content they were looking for.
Other causes of 404 pages may be in the code of your index.php or search.php files. If there’s an error in the code in either file, it may return results with invalid addresses (or it may not return results at all). If you’ve made customizations to your index.php or search.php files, it’s a good idea to check and make sure they’re not serving up invalid addresses and that all of your pages are still working. Always save a backup of the previous version of each file before making changes in case you need to roll back to an earlier version.
One of the other common reasons you get a 404 page has to do with mod_rewrite not being installed on your server. In order to use Pretty Permalinks, you have to have mod_rewrite working on your server. If you’re trying to use Pretty Permalinks and are getting errors, this is the first thing to check.
Potential Damages of Error 404 Pages
The most obvious damage caused by getting a 404 page has to do with the bounce rate on your site. If a visitor follows a link to your site and they get a 404 page rather than the content they were looking for, it’s unlikely they’ll search your site to find it. They may assume that it no longer exists on your site at all, and simply look elsewhere.
If your site is filled with 404 errors, it’s possible you’ll take a hit in search engine rankings, too. If search engine spiders are constantly presented with non-existant pages, they’ll penalize your site for having invalid links. One or two 404 pages may not have much of an impact, but if half the pages the search engine thinks should be there aren’t, you’ll take a bigger hit.
How to Prevent Error 404 Pages
The best way to prevent 404 pages is to be proactive. First of all, set up your permalinks properly from the start. If you take the time when you first launch a blog to set up well-structured permalinks, you’ll be unlikely to need to change them in the future.
Be proactive about incoming links that aren’t correct. Send a quick note to the person who runs the site with the link and ask them to change it to the correct link. Most site owners will be more than happy to do so.
Don’t take down old content. If you have to take something down, rather than deleting it entirely, create a custom page at that address that provides some information on what used to be there, or links to other posts and pages that might be of interest to the visitor.
There are a variety of plugins out there that can help you prevent and manage 404 pages, too.
10 Plugins to Deal with Error 404 Pages
The plugins below can go a long way toward preventing your visitors from ever seeing a 404 page. These plugins are all free and range from plugins that auatomatically redirect your visitors to ones that simply log 404 errors.
404 Notifier This plugin from Alex King will help notify you of any 404 errors coming up on your site. It’s a very useful plugin to use if you’re changing your permalink structure or otherwise moving things around and are worried you may have missed some things and don’t want to risk broken URLs.
Smart 404 The Smart 404 plugin helps eliminate 404 pages automatically. If a visitor reaches a page that will return a 404 error, this plugin searches the requested URL to see if there’s some other post that likely matches. If there’s more than one potential match, it can return a list of possible links. It goes a long way to help remedy a high bounce rate caused by 404 errors.
Google 404 This widget makes it easy to embed a Google search box on your custom 404 page.
The Free 404 Plugin This plugin creates a customized 404 page that includes related posts to whatever keywords appear in the requested URL.
JH 404 Logger This plugin adds a dashboard widget that displays recent 404 errors. It’s a great, unintrusive way to see if your site is returning errors.
WP 404 Images Fix This plugin lets you replace images returning a 404 error with a default image of your choosing. You also have the option to add a class to the img tag or hide the image entirely if it’s missing.
Dunstan-style Error Page This plugin can be used to create a custom error page similar to the one used on Dunstan Orchard’s 1976design.com/blog. The custom page it creates is immensely useful to users, displaying the last five blog posts, a search box, and the option to report the error, among other options.
Permalinks Moved Permanently This plugin is helpful if you change the permalink structure of your blog and don’t want to lose out on incoming links going to your old pages. In addition to redirecting the visitor to the new link, it also generates a “301 Moved Permanently” error so that visitors are automatically redirected in the future (along with search engine spiders).
Redirection This plugin monitors 404 errors and lets you map them to 301 redirects. It also allows you to set a custom redirection that lets you pass a URL through to a different page, file or website. And it creates a full log of all redirections. It can be used to redirect both nonexistent pages and ones that exist and it can be set to redirect based on login status or other parameters.
There are a lot of other resources out there that can help you deal with 404 errors on your WP blog or other website. Here are some of the best ones:
- Check for Dead Links – Part of an article in the WordPress Codex that includes a number of links for finding dead links on your site.
- WordPress Tip: Customizing Your 404 Page – A short guide to customizing the 404 page that comes with whatever theme you’re using.
- Creating an Error 404 Page – The official documentation from the WordPress Codex.
- Customize Your 404 Page from the WordPress Admin – A guide to creating a 404 page template that can be edited right from within WP’s admin area.
- Custom 404 Pages for WordPress Theme – A post that provides some great ideas for what you might want to include on a custom 404 page.
- Best WordPress 404 Error Page Designs – A gallery with twenty awesome examples of 404 error pages. (The images above were all sourced through this post.)