In a previous post I outlined how to redirect all 404 errors to your WordPress home page. However, this can confuse Search Engines as they would think content sits at the page that doesn’t actually exist any more. How can you eliminate the confusion, while expediting the remove of theses pages from search engines AND keeping visitors on your site?
By using an http status code of 410 Gone and a custom page.
For WordPress blogs, you can simply edit your theme’s 404.php page (see my previous post to find or create this file) and add the following PHP function in front of any content:
<?php header("HTTP/1.1 410 Gone"); ?>
If you wanted to add content, just add the following after the above:
<?php get_header(); ?> Add Content Here <?php get_footer(); ?>
This will ensure your custom 404/410 page is consistent with your them. You can list your most recent posts, place a search box, whatever your heart desires.