
There are times when we remove pages from our website due to some reason, and later when some visitor comes to that page, he gets an Error 404 page. Without even giving a second look at your site, he quits to Google or some other search engine.
There is a way to redirect users from the error 404 homepage to your site’s main page. It requires you to place a PHP code within your site’s root folder. I have tested the code with WordPress, and it works fine.
Below is the code to redirect 404 errors to your homepage. Copy the code and paste it in the 404.php file which can be found in your Themes folder.
Remove everything that is written in that file and replace it with the below code.
<?php
header(“Status: 301 Moved Permanently”);
header(“Location:http://www.abc.com”);
?>
Make sure that you replace “http://www.abc.com” with your domain name.
RELATED POSTS:








