Hi Everybody!! Today, I am going tp share with you theways to Redirect 404 Page To Homepage In WordPress. I think most of theusers browsing on Internet have at least once experienced a 404 Error Page.
One can fix it by just fixing the broken link. However, these can still occur even when the website owner is continuously fixing them. In this case, one has to redirect them to another page in order to reduce your website’s bounce rate and retain your visitors.
In this post, I am going to show you How To Redirect 404 Page To Homepage In WordPress. But, before we get into that, let’s check what 404 errors are and why are they harmful to your site.
Must Read: How To Add Nofollow Links In Gutenberg
What is a 404 Page?
A 404 is a HTTP response code which tells that the server could not connect to the website or URL you entered. It means that the webpage you entered does not exist. It is shown in different ways such as Error 404 Not Found, 404 Not Found, 404 Page Not Found, Server Not Found and so forth.
Must Read: How To Add Google Analytics To WordPress
Why to redirect a 404 Page?
The disadvantage of 404 errors is that they drive avisitor away from your site. As I mentioned above, this affects your website’sbounce rate, which is the rate at which people are getting away or bouncing offyour website. It can be a problem, since Bounce Rate is a very importantpart of Search Engine Optimization (SEO).
So, the best way to avoid the harm to SEO is toredirect 404 page to Homepage of your website. In this post, I amgoing to show you two easy ways to do the same.
Must Read: How To Clear WordPress Cache
How To Redirect 404 Page To Homepage In WordPress
1. Using a Plugin
It is very simple to redirect a 404 page to your homepage using a WordPress Redirect Plugin. To do this, we are using the All 404 Redirect to Homepage plugin. To start the setup, we need to first install and activate the plugin.
After the plugin is installed and activated,it will start working automatically. You can go to Settings →All 404 Redirect to Homepage from where you can disable theplugin or change the URL of the page where the 404 page redirects. Click on UpdateOptions after you’ve made any changes.
2. Editing The php File
In this method, I will show you How To Redirect 404Page To Homepage by editing your website’s 404.php file.
To do this go to your WordPress theme directoryand edit the 404.php file in your WordPress Admin or Dashboard.
Now, add the following script at top of file:-
<?php header("HTTP/1.1 301 Moved Permanently"); header("Location: ".get_bloginfo('url')); exit(); ?>
So, these were the some ways to Redirect 404 PageTo Homepage In WordPress. Now you know how to Redirect 404 Page To Homepage.I hope you found this post helpful. If you have any doubts/suggestions thenplease comment in the comment box below.