You’d be amazed how many 404 errors even the best websites have.  Short of having an amazing 404 page, the best quick fix is to redirect your 404 errors to your home page.

(And before the technical folks jump in and say all the reasons why a it’s a bad idea to redirect 404 errors to the home page, keep in mind that redirecting to the home page is a much better solution than the truly god-awful 404 page that comes standard with most WP themes.  And passing the link juice from links pointing to 404 pages to your home page is a huge benefit of following this method).

Update:  You can now download the 404.php file here and change the file name from 404.txt to 404.php and then just upload it to your theme folder.  It’s that easy.

Basically you want to have the code below in your 404.php in your theme folder.  Some themes don’t come with a 404.php file, so you’ll have to create one.  If you already have a 404.php file, then overwrite the contents of that file with this code:

//Simple Redirect for WordPress.
//Christopher Carey
//301 Redirect for WordPress
//http://wwww.noheat.com
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));
exit();

And you’ll need to add <?php to the front and ?> to the end so that the code runs.  I would have added it to the code snippet above but it keeps breaking.

Hope that helps and if you have any problems just drop some comments in the form below and I’ll help you out.