Home > Featured > WordPress site redirect missing pages to the homepage
Bookmark and Share

WordPress site redirect missing pages to the homepage

Posted on September 02, 2012 | Filed in Featured, Wordpress

If you are using WordPress and have updated a website, chances are that many links from your older site are outdated.
There is a simple way to avoid showing visitors a 404 page.

Just create a file called 404.php and upload it to your active theme folder. This file will make WordPress produce a 301 redirect to the homepage or any other URL you may like for all missing URLs on the site.

<?php
header(“Status: 301 Moved Permanently”);
header(“Location:http://www.abc.com”);
?>

Leave a Reply