This article will cover how to redirect your 404 pages to the home page in WordPress.
404- Page not found error can increase your website’s bounce rate of your website but redirecting your 404 pages to the home page can help your users find the valuable thing on your website.
Most users who visit your website and find the 404 pages will quit, increasing the overall bounce rate and negative impact on your website.
So, let’s see how we can redirect 404 pages to the home page in WordPress.
There are two ways by which you can redirect all the 404 pages to the home page.
1 By entering manual code
2 By using the Rank Math SEO plugin
By adding a code manually
- Log in to your control panel. Here I am taking the DirectAdmin panel. After login, scroll down and click on the “File Manager” icon.
2. Navigate to the domain and double-click on it. Select your domain name(if you have multiple domains), then double-click on the public_html folder.
3. WP_Content → themes folder and create a new file and name it 404.php
4. Edit 4.4.php, paste the code given below and save it.
<?php header("HTTP/1.1 301 Moved Permanently"); header("Location: ".get_bloginfo('url')); exit(); ?>
By using the Rank Math SEO plugin
1 Login to your WordPress dashboard.
2 Go to plugins→ install Rank Math → Activate.
3 Go to Rank Math → Dashboard → Modules → Enable 404 monitor.
4 Go to 404 Monitor. You will reach to 404 error log screen.
5 Activate Advance 404 monitor by Rank Math → General Settings →404 Monitor and click save.
6 Navigate to Rank Math → 404 Monitor. A list of URLs will appear which have returned 404 errors along with some other details like Referer, User-Agent etc.
7 Mouse hover the URL for which you want to do the redirection and click on “Redirect”.
Note:- You can select multiple URLs too for bulk redirection.
8 The redirection page will open. Add the URL of the destination where you want to redirect.
9 Repeat steps 7 & 8 for all the 404 URLs and clears the logs once you have done the redirection of every URL.
I hope this will be the article which you were looking for.
You may also like