In this “WordPress Hack” you’ll learn how to create a custom 404 Error page for your blog. It’s helps your visitors find what they need, and also helps you not lose visitors!
The WordPress “Hack-A-Thon” continues in our “30 WordPress Hacks in 30 Days Series” to help you get control of your blog!
One page you probably don’t look at very often (if ever) is your 404 Error page. What is a 404 error? It’s when someone tries to visit something on your web site and it isn’t there – the webserver displays an error page. Normally the page is white with plain black text with a short message about “the page you’re looking for cannot be found”. WordPress displays a custom 404 page based on the template file “404.php” contained within your theme directory, but by default most themes don’t have much more than “Error 404 Not Found”.
Currently my 404 error page is pretty useless showing just a heading “Error 404 Not found” and a white blank screen inside my wordpress template. I’m going to fix that as I write this hack for you. What causes these 404 errors? It only happens 2 ways, either somebody types or pastes in a bad address in the URL field of the browser, or somebody clicks on a bad link (on your site or from another site). When Wordpess can’t find the page or content it displays a page using the 404.php error. This would be a good time to mention the 404 Notifier WordPress Plugin that will email you every time someone gets a 404 error on your site. It’s an important gauge of whether people are having issues with your content (being found) or not.
A good place to start would be the WordPress Codex page on Creating an Error 404 Page. The first thing it says is that you want to remove the ugly error and replace it with something that will help visitors find their way. I couldn’t have said it better myself.
It also says that you are looking for the following text, and should modify the H2 header and add some paragraphs of text below it:
Error 404 - Not Found
There isn’t a lot of “codey hocus pocus” going on there, you just want to give users a friend message, some text to humor and help them, and then it’s up to your where you want to direct them next. Some of you may want to list your most popular posts, or maybe certain categories or pages, but in my case I want to link to only a few of those. Then I’m going to enlist the help of the Ask Apache Google 404 WordPress Plugin. It’s going to try and figure out (based on the URL) what it was they were trying to find, and display google results (for your site) to the user to try and help. I personally would prefer this plugin to search my blog only for results, but since this is the only plugin I could find that does this – google results will have to do. Check out how pimped out my 404 page looks now!
As you can see in the image above (or the link to view it directly) – we’ve come a long way baby! No more bland error page, now we get an email every time a 404 not found error is generated, and the users get a friendly message with automatic google results to try and find what they were looking for! Like I initially said – this hack helps our visitors, and helps us “keep” our visitors on the site all at the same time!
Here are some other good 404 examples to look at for inspiration:
Problogger’s 404 Page
Smashing Magazine’s Error Pages Reloaded
Web Professor’s 404
Home Star Runner
As always – if you have questions or something to add to make this hack even better, please comment now! Stay tuned for tomorrow’s WordPress hack so we can keep pimpin’ out our blogs!
Glad I stumbled onto this post. I never paid enough attention to my 404 page, but I also never realized that there is a great plugin like Ask Apache Google 404 out there. Thanks!
Thaya Kareesons last blog post..Make WP-PostViews Work with WP-Super-Cache
Sure, there’s no reason why you can’t use the sitemap generator as the content for your error page. You could use archives, or anything for that matter – it’s all personal preference. And, ‘anything’ is better than the WordPress default (nothing)!
I’ve been trying to figure out how to do this–well, in honesty, I haven’t tried, i’ve only been thinking about it. Thankfully I stumbled on this post. I think the real problem for me is that I have too many of these pages that pop up. There’s probably a deeper problem. Thanks for another informative post.
Chris at prepaid cell phoness last blog post..Verizon Prepaid Cell Phones Review
Having a 404 error page is a must for both users and the search engines. It provides the essential information readers need when a page is not found. Great hack!
.-= Albert Fang´s last blog ..Make Money Losing Weight in 2010 =-.
I’m having trouble with 404 errors on my blog. When I look at Google webmaster tools it’s picking up errors on pages that don’t exist // never existed. I think it’s hurting my rankings. Basically every page on my website has a broken link ending in /testimonials.html currently on my website. For example: http://www.kitchencabinetkings.com/blog/2010/01/testimonials.html is obviously a 404 error page and I can’t figure out why it is referenced / what this page even is
.-= Kitchen Cabinet Kings´s last blog ..Kitchen Cabinets Enhance The Ambiance Of Your Home =-.
it’s just a bunch of hackers and spambots racking up your access logs – maybe even looking for a page you used to have. If you REALLY saw all the crap that hit your blog on a daily basis you’d be shocked. It shouldn’t hurt your rankings any.
Never even considered using the 404 page to my advantage. Glad I stopped by today. Thanks.
i prefer the custom page because it doesn’t wholly turn off your readers.
.-= Paint Kitchen Cabinets´s last blog ..Contact Us =-.