How To Redirect 404 Page To Home Page In WordPress
It’s very challenging when it comes to move site from one location to other location. Also, in this complete task you may can face 404 errors and it is very annoying and negative for site’s SEO. Google hates the pages with 404 errors and he start pushing back these kind of sites in serps. Also if you deleted any article or changed any article’s permalink/URL then it also start showing 404 error.
If you are experiencing a lot of 404 page not found errors in WordPress then keep in mind these errors are not good for your site’s SEO and user experience. Whenever WordPress see a broken link or removed link it redirect’s the site’s visitors to a page called 404.php and on this page users can see the “404 error: Page Not Found” message. After watching this message some users instantly leave your site but only few of them click on homepage. So it is very negative point for site, but don’t worry you can fix this issue with a simple code. You can also design your 404 page with beautiful designs or you can show something extra on this page. But you can also redirect the users from that page to homepage or any other location with the plugin or a simple php code. So in this article we will show you how you can redirect the 404 page to homepage in wordpress with a simple code. Follow the below guide and complete this task.
Redirecting 404 Page To Home Page In WordPress
In this task you have to just add a simple code to the 404.php file and it will start redirecting 404 error page to hompage. Just follow the below steps and you will done this task in just couple of minutes.
- First open wordpress dashboard and navigate to the Appearance –> Editor.
- Here click on 404.php from the right sidebar.
- Now copy the all code from that file and paste in the notepad and save it. We are doing that for backup.
- Now paste the below code in the 404.php file at the top.
header("HTTP/1.1 301 Moved Permanently");
- Save the file and you are done.
That’s it now whenever your viewers will go to any removed or 404 page they will be redirected to the homepage instantly. There are so many other plugins available for this task but it is good to do it with a code as plugins can slow down your website’s speed and it will again through negative affect on your site’s SEO.
We hope you like our article on How To Redirect 404 Page To Home Page In WordPress and it worked for you. If yes then comment below and also share it with others and if you face any problem then feel free to comment below. We will help you for sure and keep visiting for more.