How to Redirect 404 Page to the Home Page in WordPress

redirect 404 page WordPress

What is a 404 Error, and What Causes it?

Instead of seeing the website, you receive a pop-up indicating a 404 Error when you click on the link. Sometimes, we have seen this error like 404 Error not found, which means the requested page is not available on the web.

This is an online server message sent to the user by Web-server if the web page not found. It is also an HTTPS status code. 

Other reason users see the 404 error is when potential users leave a website and visit the competitor’s site. It means you should not ignore this error and recover it as soon as possible.

One of the best ways to fix this error is redirecting the 404 WebPages with other pages. 

If you have confusion, then this post has detail information for you. We have shared some best ways to fix the 404 error. But before that, we should learn about its causes. So, let’s start!

What are the causes of 404 Error? 

404 Error is an HTTP error that indicates the web browser cannot communicate with the server, which means the server cannot precede the user’s request. Here we need to clarify that 404 Error is a website error, not the server.

That’s why the server is unable to crawl the specific page. There are certain reasons for occurring 404 errors, so have a look below.

Misspell URL: usually, we get links to reach one site to another. But sometimes, we manually enter the URL, which can create a Typo error or misspell error. Thus the user is unable to reach the website page. 

The website’s owner has removed the specific page: To enhance the website’s performance, sometimes developers make changes and updating the content in the backend that causes 404 Error. If that is the case, the owner must redirect their pages to another link. 

If the URL is linked incorrectly: most people change the post URL after updating when they update their title. This means when user is searching your old URL not a new one, then an error occurs. Ensure the links are updated efficiently by the team. 

If the server has been shut down: sometimes there is an error of the server, and you cannot do anything about it. 

How to Fix 404 Error?

With the given tips, you can resolve 404 error messages. This sometimes causes by the server, so there are some tips to fix it soon. 

Try to refresh the page 
As we said this sometimes an error of server or internet issue. To fix it, refresh the page by pressing the F5 key from the keyboard and trying the URL again. 

Cross-check your URL
Misspell URL is also the biggest reason of having 404 Error. To fix it soon check the spelling twice and thrice and retype the URL.

Navigate the Homepage
Sometimes user reach the website but not on the specific page. User can use their search panel to find what they are looking for.

Clear the cookies
If the user’s laptop or PC is overloaded with data, the cookies may not reach that specific page. To ensure cookies is the issue, you can clear the cache and cookies from the Browser and enter the URL again to check it’s working. 

When you encounter with 404 page error, the given tips might help you. But if there is a major reason such as deleting or updating URL by website owner then redirecting page or URL is the solution to fix it. 

How to redirect your 404 page to the Home page in WordPress?
Here we will discuss the two solutions to redirect your 404 page URL to the home page in WordPress. These are plugins and custom code. 

Plugins to redirect 404 Page

One of the easiest ways to fix 404 Page Error to home page in WordPress is using plugins. If you are not best in coding and don’t know about tech features, then using plugins can reduce your stress. To perform this, you will need to know about the best redirect plugins to avoid mistakes. The plugins are:

All 404 redirect to homepage
It is one of the best redirect homepage error with more than 1000 downloads. All 404 redirect to manage is simple to use because it redirects 404 pages to the home page. Unlike other plugins, it takes less time to do redirects because you do not need to perform manually. 

Safe redirect manager
It is yet another safe and coolest redirect page that allows you easily create 404 error page redirects. You can complete the redirects with simple and easy steps, non-tech people can use even the plugin safe redirect manager. With this, you will get several options that make it as the best plugin to use by anyone. 

Redirection
If you cannot use the above two plugins, then redirection is most simplest and easy plugin to fix the issues. It has millions of active users that found it as very easy and interesting plugin to create 404 error redirects. The more redirects it include login page, HTTP, headers, IP Address, server and page type, and cookies. 

Using Customs

If you know coding, then you can fix the 404 error to the home page in WordPress. In this section, we have shared the complete detail on how to redirect the error. 

To get started first open the 404.php file, if this not exists then open the blank.php file. And paste the following the code:

<?php
header (“HTTP/1.1 301 Moved Permanently”);
header (“Location: “.get_bloginfo(‘url’));
exit();
?>

That’s all! By using this code, you can easily be redirected to homepage in the WordPress. 

How to track 404 pages and redirect them in WordPress?

To track the 404 pages, first, we need to redirect the URL in WordPress by using one of the above plugins. The best part about using a redirect plugin is you do not need to work on custom coding, and all work can be done easily by performing simple steps.

  • Install the Redirection plugin and activate it.
  • Once the plugin activated go to tools-redirection and set up your redirects.
  • Under the “add new redirect section”, paste the URL you want to redirect and add the new URL whom you want to redirected with. 

It might seem confusing for you. But it can be easy when you do it yourself. Ensure you are adding the right URL under the redirect URL, so the errors not found again. For your clarification, we are explaining all the features of redirection window.
 
You will see the options like source URL match, action, regular expressions, target URL, and group in the window. 

Under the matchbox, you can see the various options such as URL only, URL and referrer, URL and user agent, and URL and login status. In many cases, you can use URL and referrer because you see a number of 404 errors requests for the specific page.

This is not a misspelled error, so it has to be link safely to the next URL. With this, whenever the user trying to check your link, they will redirect to your new location. 

Now you want to track the URL if it is working or not. Once you enter the new URL, hit to add redirection and go to the new URL to make the test. 

With the redirection plugin, you have an option to track the new URL. Click on the 404s link at the top of the page and it will show you 404 errors occurred on the site.

With this plugin you can check Old URL, New URL, and more interesting facts to help you make the relevant changes. 

404 pages are bad for your website

If your website is getting 404 Error, then it is not best for SEO practice. Well, these are natural errors and part of the website that occurs sometimes, but it is bad for your website. 

When user reaches on 404 page they immediately redirect to another site, means losing of much traffic, revenue, and sales. And that’s not a good SEO practice.

If you want to make your website easy to work and reachable to users, then ensure your site has no 404 page errors. If that is the case, then redirect it to another page. 

In SEO practice, if the website has many 404 errors, this is not a lovely reputation. This convinces any search engine that your website is poor and has low maintenance score.

It is said that about 90% of online users do not sue that website after getting such bad experience.

Hence to avoid bad experience of the customers, gaining much traffic, and increasing revenue, you need to look after your website errors. 

Redirecting 404 pages to your homepage is a bad SEO practice

Around 11% of 404 redirects deliver bad response to the user, which is a bad SEO practice. If your website checks these errors, redirect it to the homepage and improve your user experience. 

According to John Muller, most search engines like Google, Bing, and more do not accept 404 errors.  

He said the impact of redirecting the 404 errors to the homepage found that Google take away such redirects from the search index and won’t surpass the ranking to the homepage. 

Redirecting the URL from one page to another is also considered a bad practice that ends up confusing users. It is because user will not get the information they are looking for. They landed on the homepage and leave the site with no information. 

Google doesn’t want to give such a bad experience to the user. If you really want to pass the user with redirect, then take them to relevant info what they are looking for. 

How to effectively handle 404 pages?

One of the crucial steps to handle 404 page is to create a high quality 404 error page. Your aim should be to create an effective landing page that gives them reliable information or can easily search their queries. 

You can redirect them to a beautiful landing page with a sorry message along with navigation (search) box, so they can look into your site and get good experience. 
 
 
To know whether your users receiving 404 error or not, use tools like search console. A most common and free web tool to know about the error and fix them all.

This tool also allows you to know about dead links and other major errors that hampering your website quality.

How to create good 404 page?

As we said, you should create an attractive 404 page so the user won’t get a bad experience with your site. 

  • You can use funny pictures or messages.
  • The page should provide useful kinks related to their query.
  • The page should have a search box.

With some efforts, you can easily redirect user towards the site, and Google will not hamper your ranking.

Redirect known 404 pages to their new address

If your site has some 404 pages, your job is to redirect them to a new location and URL. Suppose the page is permanently deleted, you can redirect users to an alternative page with relevant information. 

If you’re updating the page at the backend, redirect with a page showing sorry and relevant information to their quires. Otherwise, you can use automatic 404 redirects.

What are the benefits of automatic redirects?

Automatic redirects help your visitors to find the easy way to handle redirects. This will settle your broken links, 404 error page, and more with ease. 

Using automatic redirects is much better than doing it manually. Moreover, it comes with various advantages such as:

  • Enhance user experience
  • Reduce the stress of redirecting URL
  • Reduce the stress of maintaining redirects
  • Make redirects easier to handle

You are suggested to follow each step carefully and make your user experience best that would help you rank on the top. 

This article discusses why and how to redirect 404 page to Homepage of WordPress websites.

The HTTP 404 error is basically page not found error.

It can either be client side error or server side server.

In client side error, a user types an URL that is not valid or wrong.

In such a scenario, the response from the server side will be null and hence, the user will see a 404 page not found error.

On the other hand, when a client types an URL or goes to an URL from social media pages or search engine to your website but somehow that page is missing from your server, he will see page not found 404 error for no fault of the person.

In such a scenario, it is important to redirect 404 page to the home page in WordPress so that the person can browse other things.

Why Does 404 Error Happen?

There are various reasons why 404 error can happen.

It could be due to the typing mistake of the user when he manually types an URL.

It is important to note that the user must type the domain name and extension correctly else you will not be able to redirect 404 page to the home page in WordPress.

The most likely occurrence of 404 error from server side is when you migrate a website from one domain name to another or when you migrate it from one web server to another.

The chances are more in the second case due to different permalinks structure and other factors.

There are likely to be many broken links that you have to find out and fix, but in the meantime, you can redirect 404 page to the home page in WordPress so that users do not leave disappointed.

This is a better approach than showing the users a customized redirect page which does not serve your purpose, and the users are likely to leave your site and check the same topic on your competitor’s site.

How To Redirect 404 page To The Home Page in WordPress Using Redirection Plugin

The first thing you need to do is install Redirection plugin.

Redirection Plugin

download

You have to go to the Dashboard and from the left menu, select Plugins and then click on Add New option. Search the plugin by its name and install and activate it.

Then go to Tools from the Dashboard and click on Redirection to set it up perfectly.

redirect 404

In the screen shown above, you have to enter the 404 error pages’ URLs one by one in Source URL and add the corresponding new URLs to target URL which could be the home page.

Apart from that, it comes with various options to redirect people according to the source by changing the Match option to URL only, URL and user agents (only for registered users and subscribers) and URL and referrer (only for referring sites).

The last two options will help subscribers, site members or referring sites to go to target URL which may not be the home page and can be something similar to the old page that has got deleted or broken.

Once everything is done, you can check yourself by going to the broken URLs and see the expected result.

The drawback of this method is the fact that you have to know the broken URLs so that you can redirect to home page or any other page for that matter.

404 redirect WordPress

There is a solution for that too. Redirection provides a tab to check the URLs which people are typing wrong and the pages where people are getting 404 error. Accordingly, you can copy those URLs and set the target URLs.

As a matter of fact, you can also detect bots that are trying to access each and every page to get a loophole to access your website from this list of 404 URLs. You can block such bots by IP address and take necessary security actions.

One of the best features of this plugin is that fact that if you happen to modify the URL of an existing and published post, the plugin automatically sets a redirection for the old URL which might have been crawled by the search engine.

Another plugin which redirect 404 pages to directly homepage is

All 404 Redirect to homepage plugin

All redirect 404 to homepage WordPress

download

How To Redirect 404 page To The Home Page in WordPress Using Code

If you do not want to take the headache of knowing the URLs of the broken links and then fixing it and just want to redirect your 404 page to home page in WordPress, you have to write the following code.

But before that, you need to connect your FTP to your web server and in the theme’s folder, you will find a file named 404.php. In case you do not find it, you can create one with the same name. Open the file and paste the following.

Save the file and disconnect FTP with the web server. Now, whenever a user types a wrong URL, or he lands in a 404 error web page on your website, he will be redirected to the home page.

Why Should You Fix 404 Error At Earliest?

If your website has 404 error or broken links, Google crawlers will downgrade your website because it is directly impacting user experience.

For example, the search engine result page is showing a post link to the users from your website. When the user clicks on it and reaches your website, he finds out that the page does not exist.

This is what leads to bad user experience. If you could redirect the user to a similar article URL on your website through Redirection plugin or at least send him to your homepage, it would have been better.

Even having a 404 redirect page that will appear for every broken link will do instead of showing an error.

404 redirect WordPress

Furthermore, it creates a bad impression to your subscribers, and they are likely to unsubscribe you if they get too many 404 errors after you have moved your site from one domain to another or from one web host to another.

Therefore, redirect your 404 page to the home page in WordPress at earliest.

About Shri Posts

Shri PostsShri shares exciting WordPress themes, plugins and other WordPress related news for our viewers. He also posts selected WordPress developers interviews from time to time.

Free Posterity Theme