How to Redirect 404 to the Homepage and if it is the right way to use it?

How to redirect 404 to the homepage and if it is the right way to use it?

As a WordPress website user, there are times you will encounter a 404 page, there are two main reasons behind this, while considering when redirecting them.

How is it done?

Now, is this recommended, or there are situations when it’s better not to redirect to the homepage?

The prime focus of WordPress developers is to eliminate the 404 pages as website owners know that it is for a fact that many visitors will leave immediately to check out other sites.

So, it is compulsory to keep them on our site by redirecting them to the website homepage. However, redirecting a 404 to a homepage operation needs to be done carefully.

As many website designers, create custom-designed 404 pages and do not redirect their users. Instead, they should give visitors something nicer to appear.

People are accustomed to seeing 404 pages as an e-commerce site consists of thousands of pages and therefore, it is impossible to prevent tens or even hundreds of 404 error messages. Visitors do not see the pages that specify the products and long after the selling is stopped; the product page remains online but no longer exists.

These kinds of circumstances are not ideal; the user gets a bad experience and SEO is poorly affected.  The solution to this problem is that you can consider taking an SEO test online and look for factors why is not working properly.

Redirect 404 to homepage: To do or not to do

redirect home

404 pages can give you a little part of the information for visitors to your site.

  • They provide the information to the users about the page, they are looking for doesn’t exist or cannot be found.
  • The 404 error gives a message that they must have mistyped the URL.
  • The web page the user is seeking is not an actual web page
  • A live web page was removed or the name was changed along with the URL
  • The link to the blog posts consists of a wrong URL

Nevertheless, many visitors will think why they are seeing a 404 page and they may well be potential clients/customers.

Best WordPress Hosting

Pros of redirecting 404 pages to your homepage

  • Users can search your website by simply typing a related keyword into their search engine. However, they will get frustrated when they only find a 404 page. To maintain the traffic, you can redirect to the homepage.
  • If your website consists of too many 404 errors, the best option is to redirect users to the homepage and there give them the reason for this problem.
  • If you forget to change the URL of an old blog post that has a new title, users will get a 404 message and they will never reread the article.
  • Inactive PPC ads that are meant to direct to a landing page, will trigger more 404 pages than is good for business

Cons of the WordPress 404 redirect to homepage

  • If all pages are redirected to our homepage, it can be confusing for users if they are trying to reach a specific page and keep landing on a homepage.
  • An irregular volume of 404 redirects will affect the site’s search rating. However, redirecting non-existing URLs to our homepage will seem like you are misleading Google.
  • Huge websites don’t get any advantage from redirecting all 404s. The server would have to process an endless number of redirects and this would result in making the website too slow.

How to redirect 404 error page to homepage in WordPress

redirection

For blogs, portfolios, and other more specific content, it’s advisable to handle the related 404 pages one by one, so they are redirected accordingly. Likewise, if you have simply moved a blog post, users must be guided to the new location. The same applies to broken and old URLs.

Install and activate a Redirection plugin to do this one-by-one steps.

  • In Tools > Redirection > Add new redirection.
  • In the Source URL box, type or paste the broken/old/altered URL.
  • In the Target URL box, type or paste the new URL.
  • opt for URL and referrer in the match dropdown.
  • In the Action box, chose Redirect to URL.
  • Click on Add Redirection.

In case many pages are being displayed with the 404 error on our website, it is advisable to redirect them all to our homepage rather than lose traffic.

This is how to redirect all 404 pages to our homepage: Manually or via a redirection plugin.

Manually

  • Search in the theme folder – /wp-content/themes/theme name/ – for the PHP file.
  • Rename the file to 404-original.php.
redirection new file
  • Then, make a new PHP file in Notepad.
  • Open a new document and copy and paste the following code:
				
					<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));
exit();
?>

				
			
  • Save it as php – All files
  • Now, go back to /wp-content/themes/theme name/ to upload the new 404.php to the active theme folder

Alternatively, a redirection plugin can also be used to redirect all 404 error pages to the homepage

Installing Redirection Plugin

install redirection
  1. Log in to the WordPress admin dashboard, select the Add Plugins page and click on the plugin of choice.
  2. Install and activate the plugin.

Go back to settings on the dashboard to enable the plugin

add new redirection
  • Set the 404 Redirection Status to Enabled.                              
  • Type or paste the URL of our homepage.
  • In the section Redirect all 404 pages.
  • Click on the Update Options button to save the changes.

Final views on the redirect 404 to the homepage

404 errors are common to see and most users know that web pages undergo various updates.

However, if the 404 errors are causing customer dissatisfaction, and a reduction in traffic, then redirecting users to comparable content, through links on the homepage, is the best solution.

Redirect 404 to the homepage in two ways –

  1. Creating a new php file with the appropriate code and uploading it to the theme folder.
  2. If the website is facing a loss of traffic due to too many 404 error pages, then redirect all 404 pages to the homepage with the help of the redirection plugin.