in Blog

How to Redirect 404 page to the Home Page in WordPress?

404 errors are one of the most common reasons visitors abandon a website. Because of 404 pages, a website owner might lose a lot of traffic and potential backlinks in addition to losing business.

404 errors can be caused by a variety of issues, including:

Content on the webpage has vanished: This might happen when a server goes down, or a website is being transferred.

Updating older blog entries. When individuals change the title of a blog post, they generally change the URL as well. Visitors who access your site using the old URL will be directed to a 404 error page.

What Does a 404 Error Mean?

The 404 error is a Hypertext Transfer Protocol (HTTP) standard response code that indicates that, despite the browser’s ability to interact with the server, it could not obtain the information requested by the user.

In WordPress, how do I redirect a 404 page to the home page?

In this post, we’ll go through two different methods for redirecting 404 pages to the homepage. They are as follows:

This is the most effective technique to redirect a 404 error page to You won’t have to create a single line of code for the homepage. It is recommended that you utilize a plugin to prevent making costly mistakes when developing code. You may use a variety of plugins, including the following:

All 404 Redirect to Homepage- With over 200,000 downloads, All 404 Redirect to Homepage is one of the most famous 404 redirection plugins. It’s also the easiest to use because it automatically redirects all 404 pages to the homepage, unlike most other plugins that need you to set redirects for specific URLs.

Safe Redirect Manager- Another plugin that makes it simple to generate 404-page redirects is Safe Redirect Manager. It has a lot of features that make it one of the most incredible plugins to utilize.

Redirection- With over one million active installs, Redirection is by far the most popular 404-page redirection plugin. It’s simple to use and includes several other features that we found to be quite appealing. You may, for example, send visitors who use a specific web browser to a particular page. Login status, Referrer, Cookies, HTTP headers, IP address, Server, and Page type – redirect if the current page is a 404 page – are among the various conditional redirects.

How to use the ‘All 404 Redirect to Homepage’ for redirecting?

Installing and Activating the Plugin is the first step.

Step 1: To begin, The All 404 Redirect to Homepage plugin will be installed initially. You may do so either by downloading it from WordPress.org or by going to Plugins > Add New in your WordPress admin panel and searching for the plugin. After you’ve finished installing the plugin, be sure to activate it.

Step 2: Adding Customizations to the Plugin. You’ll need to configure the plugin and define the redirection rules now that it’s installed and enabled. To do so, navigate to the Settings area of your WordPress website’s admin panel and click on All 404 Redirect to Homepage.

This will bring you to the plugin’s Settings page. Here, select 404 Redirection Status from the dropdown menu, and to enable the plugin, choose Enabled. After that, you’ll be prompted to input your website’s homepage URL in the “Redirect all 404 pages to” area. Your homepage URL will be stored in the plugin. This area may be used to add any other custom URL.

Step 3: After you’ve finished making your adjustments, click the Update Options button. In this instance, all 404 pages will now redirect to the homepage. Test the modifications to ensure that everything is working correctly. You may do so by going to your website and typing in a URL that doesn’t exist.

Using code to redirect 404 pages to the homepage

If you don’t want to utilize a plugin, you may write code to redirect 404 pages to the homepage. To do so, log in to your server and navigate to the Public HTML folder or the folder containing your website files. You may also retrieve your website files by an FTP file application such as Filezilla. Logging onto the WordPress dashboard and going to Appearance > Theme Editor is another option.

Regardless of the technique you use, look for a file named 404.php, or build one if 404.php already does not exist, and add the following code to it:

‘’<?php’’  

‘’header(“HTTP/1.1 301 Moved Permanently”)’’  

‘’header(“Location: “.get_bloginfo(‘url’)’’

‘’exit(); ‘’  

“?>”

Save the changes when you’re finished. When a 404 error occurs, website visitors will now be routed to the homepage.

Avoid the 404 error by following the steps outlined in this post or head to Seahawk Media for getting any professional WordPress-related services. Head to Seahawk Media, since our top-notch design team will collaborate to create a WordPress platform you’ll love.

REACH OUT

Writer and a Baker, working hard to earn the name and fame in the writing industry. Published 100's of articles and blogs for domestic and international clients.

Stay in the loop

Subscribe to the weekly newsletter for all the latest updates

Wordpress Social Share Plugin powered by Ultimatelysocial