Redirecting errors 404 of WordPress to your homepage
I learn from the blog MrIntech that there is a very interesting how simple trick to eliminate the error 404 that may appear on your blog, turning them into automatic redirects to the homepage (Blog, in this case).
As we know, the error 404 stands for “Page not found”. This may be because the page / post has since been removed, or maybe never existed and the user simply mistyped the address.
Personally, Google Webmaster Tools tells me many error 404 because the blog entries translated automatically using a special plug-in. Sometimes the pages are not translated, and form of the dead in the sitemap link.
Using this code, automatically disappear all these errors.
We go to the directory on your WordPress theme, we find (or create, if there is no) 404.php page and insert this code ONLY:
<?php
header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: “.get_bloginfo(‘url’));
exit();
?>
Save, and load this page on the FTP server.
Now anyone enter an incorrect address, will be automatically redirected to the home page of the blog. This can be useful even to those who do not have direct access to their htaccess file..
Comfortable, not? 🙂