Hosting + Ai Website Builder + Free Domain (3 Month Free Credit)
Shop Today

How to Redirect your 404 pages to the Home Page in WordPress

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

  1. Log in to your control panel. Here I am taking the DirectAdmin panel. After login, scroll down and click on the “File Manager” icon.
File Manager

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.

public_html

3. WP_Content → themes folder and create a new file and name it 404.php

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();
?>
How to Redirect your 404 pages to the Home Page in WordPress 1

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.

How to Redirect your 404 pages to the Home Page in WordPress 2

4 Go to 404 Monitor. You will reach to 404 error log screen.

How to Redirect your 404 pages to the Home Page in WordPress 3

5 Activate Advance 404 monitor by Rank Math → General Settings →404 Monitor and click save.

How to Redirect your 404 pages to the Home Page in WordPress 4

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.

How to Redirect your 404 pages to the Home Page in WordPress 3

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.

How to Redirect your 404 pages to the Home Page in WordPress 6

8 The redirection page will open. Add the URL of the destination where you want to redirect.

How to Redirect your 404 pages to the Home Page in WordPress

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

YouStable

Power up your business website with YouStable India’s affordable unlimited web hosting services and meet your online success! YouStable is not just a brand that provides hosting services to clients. The quality of services a customer gets from us is unparalleled and our clients know it.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top