WordPress 404 Homepage Redirect

Page not found. Once a visitor reads it, tendency is for them to leave your page. Not good!

If you’re using WordPress, here’s a very simple code to automatically redirect all your lost visitors back to your homepage:

header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));exit();


All you have to do is replace the content of the 404.php file in your WordPress theme and your good to go! ;)