HomeBlogRedirect 404 error to Homepage in Wordpress (Solved)

Redirect 404 error to Homepage in WordPress (Solved)

How do you change your 404 error page to home page? This is useful if you recently deleted any of your web pages and still search engine brings traffic to that page. If your website is for your business, it is annoying that some one searched for a product in your website and finally end up with 404 error.404-error-00

There are several methods to address this issue. You can either redirect the error page to another product page. If you have several missing pages or link, the easy way is to redirect your wrong page traffic to home page.

It is easy to redirect 404 error page to home page. Go to your wordpress dashboard > Appearance > Editor and and select your theme.

404-error-01

Find 404.php file. Select the file to edit. If you don’t have 404.php file, please create one and paste the following code into it.

 

<?php

header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: “.get_bloginfo(‘url’));

exit();

?>

 

That is all, this will redirect all 404 and 301 error to your home page. This is better than ending up with 404 error page or unknown error.

Disclosure: Mashtips is supported by its audience. As an Amazon Associate I earn from qualifying purchases.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

You May Like

More From Author