How to Redirect 404 pages to the Homepage in WordPress?

You may have encountered frequently 404 error pages, if you are an internet user. The error will get raised, when the permalink of a website is modified without changing the links pointing at the original URL. This error looks common, you might experience this error lot of time. Most website owners may think that this 404-page error may looks normal, this might not affect the website. However, this error would bring you some negative impacts on your website, if not troubleshooted.

It may affect your potential customers and your growth through the website. If the error not fixed then it would affect the SEO by damaging your website’s backlink.

This article will discuss about the following,

  • What is a 404 error?
  • Why you should redirect 404 pages?
  • How to redirect 404 pages to the homepage in WordPress?

What is a 404 error?

A 404 error will get raised when the browser can’t find the server of the requested website. That means, the page is not exists at the moment. The 404 pages will be displayed in different ways in different browsers. The 404 error message will be displayed in different ways. 404 Error, 404 Page Not Found, Error 404 Not Found, etc.

Reason of 404 Page Error:

There are many possible ways where the 404 page error will get raised.

  • The permalink of your website will be modified without changing the link point to the original URL.
  • Moving the website from one host to another.
  • You would mistype the domain name.
  • The connection to the server of the website may be disconnected or not in running state.
  • May be domain name is not existed.
  • The domain name system may not convert the domain name into IP.
  • Finally, the 301 redirects will not be added.

However, the above are the reasons for the cause but the points should be cross verified when you get into the troubleshooting process.

Impact of a 404 error

First and most impact is that the visitors will go away from using your website. It is common because the visitors will move off to another website, if they don’t get what they need. This might affect the bonus rate of your website, if they frequently exist from your website after viewing one page. The impact looks serious because the bonus rate looks important in SEO.

How to redirect 404 pages to homepage?

The best way to solve the 404 error is by redirecting the page to the homepage of your website. This gives another choice to explore their needs easily.

In this section, I will give you a solution to remove 404 page error by using two methods i.e.

  1. Using custom code
  2. Using a WordPress Plugin

Method 1: Writing Custom Code

If you think to avoid using WordPress plugin to solve the redirect homepage issue. You can go with this solution of using the custom code. To do this, just login in to your WordPress dashboard and then navigate to Appearance à Theme editor.

Now you can see a file called ‘404.php’. If the file missing then create the file in the name of ‘404.php’ on the current theme folder. Finally, just copy the following code and paste it in that file.

Finally, click the button ‘Save changes’. From now all your 404 pages will be directed to your home page of your website.

Just follow the below screen, it takes you to the theme editor page.

redirect URLs using 404 page

Method 2: Using a WordPress plugin

Second method is to remove 404 pages by using the plugins available in WordPress repository. The main advantage as you don’t need to write codes to redirect 404 pages. Experts in WordPress recommends the website developer to use the plugins to remove 404 page errors.

There are many free plugins available in WordPress repository which would give you the solution to remove 404 pages issue. Here, I suggest you to go with a new plugin called ‘Redirection‘.

install redirection plugin

 

It is the best redirection plugin for WordPress and it has 2 million downloads. The redirect features available in this plugin helps in tracking all 404 page errors and allows you to setup 404 page redirects in WordPress. So, to perform the redirect process, just follow the below procedure.

Step 1: First, you need to install and activate the plugin. (See the image above).
Step 2: Just traverse to Tools -> ‘Redirection’ option in this plugin.

redirections plugin settings

Step 3: It takes you to new redirection page where it has many options to handle the 404 error.

add new redirection

Step 4: You can now add redirects under the label ‘Add new direction’. Here you need to add source URL and target URL.
Step 5: You can now monitor the redirect logs.

redirection log

Step 6: Next, import/export source URL and target URL. Here you can add the codes for redirection.

import redirect urls

Step 7: Other options to manage the redirection activities.

redirection options

Step 8: Finally, you can monitor the plugin status under ‘Support’ tab.

check redirection plugin status

Summary

Automatic redirect looks best way to handle 404 error pages on your website. No fix or intervention is needed to handle the 404 errors and it automatically directed to the target page. I recommend you to use the plugins to manage the 404 errors because the plugin holds many features like logs, import/export options, etc.

Hope you like redirect 404 error to homepage. You can follow us on Facebook and Twitter to get the latest updates.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.