How to install Google Tag Manager on WordPressMarch 27, 2020
WordPress updating failed: How to fix this errorApril 13, 2020
If your WordPress website users encounter a 404 page, there are two factors to consider when redirecting them.
- How is it done?
- Is it recommended, or are there circumstances when it’s better not to redirect to homepage?
Many WordPress developers are focused on eliminating the 404 pages, because website owners know that many users will leave immediately to check out other sites.
So, the first reaction is to keep them on our site by redirecting them to our homepage. However, redirecting a 404 to homepage operation needs to be considered carefully.
This is because many websites design custom-designed 404 pages and do not redirect their users. Instead, they prefer to give visitors something nicer to look at.
People are accustomed to seeing 404 pages because an e-commerce site has thousands of pages and it’s impossible to avoid tens or even hundreds of 404 error messages. Products pages are left unattended and long after the shop stopped selling the product the page remains online but no longer exists.
This situation is not ideal; the user does not enjoy the experience and SEO is negatively affected. What you can do is take an SEO test online and see what is not working properly.
Redirect 404 to homepage: To do or not to do?
404 pages can provide a little bit of information for visitors to your site.
- They let users know the page they are looking for doesn’t exist or cannot be found
- The 404 error provides a clue that they have mistyped the URL.
- The web page they are looking for is not an actual web page
- a live web page was removed or changed its name and URL
- The link to the blog posts contains a wrong URL
Nevertheless, most visitors will wonder why they are seeing a 404 page and they may well be potential clients/customers!
I'm interrupting the article to tell you about BeTheme, the definitive multipurpose theme. If trying to satisfy multiple clients has become more stressful than rewarding, BeTheme is the solution for that.
BeTheme’s selection of hundreds of customizable, responsive pre-built websites is the highlight and a proven stress reducer.
The customizability of the theme makes it a dream come true for its users. There are 4 types of Page Builders that you can use with it: WPBakery, BeBuilder, and Elementor among them.
And now with the Live Builder, it’s even more impressive.
Check out BeTheme and see why our users love it!
The rest of the article is down below.
Pros of redirecting 404 pages to your homepage
- Users can locate your website when typing a related keyword into their search engine. However they will be disappointed when they only find a 404 page. To keep traffic, you can redirect to the homepage.
- If your website has too many 404 errors, it's best to redirect users to the homepage and there provide them with an explanation. To check this, look for crawl errors in our Google Webmaster Tools account.
- By forgetting to change the URL of an old blog post that received a new title, users will get a 404 message and nobody will ever reread the article
- Inactive PPC ads that are supposed to direct to a landing page, will trigger more 404 pages than is good for business
Cons of the WordPress 404 redirect to homepage
- Redirecting all pages to our homepage can be confusing for users if they are trying to go to a specific page and keeping land on a homepage.
- An irregular volume of 404 redirects will bring down our site’s overall search rating. However redirecting non-existing URLs to our homepage will look like cheating to Google.
- Huge websites don’t benefit from redirecting all 404s. The server would have to process an endless amount of redirects and the website would become too slow.
How to redirect 404 error page to homepage in WordPress
For blogs, portfolios, and other more specific content, it’s advisable to handle the related 404 pages one by one, so they can be redirected fittingly. If we have simply moved a blog post, users need only to 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 operation.
- 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 drop down
- In the Action box, chose Redirect to URL
- Click on Add Redirection
If there are many pages showing the 404 error on our website it is best 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
- Look in the theme folder – /wp-content/themes/theme name/ – for the php file
- Rename the file to 404-original.php (to keep it in case you later change your mind)
- Then create a new php file in Notepad
- Open a new document and copy and paste the following code:
header("HTTP/1.1 301 Moved Permanently");
- Save as php – All files
- Go back to /wp-content/themes/theme name/ to upload our new 404.php to the active theme folder
Alternatively, you can use a redirection plugin to redirect all 404 error pages to homepage
To install a redirection plugin:
- Log in to the WordPress admin dashboard, select the Add Plugins page and click on the plugin of choice
- Click Install and activate the plugin
- Return to settings on the dashboard to enable the plugin
- Set the 404 Redirection Status to Enabled
- Type or paste the URL of our homepage
- In the section Redirect all 404 pages
- Save the changes by clicking on the Update Options button
Tip: To test the redirection plugin, type a made-up URL into the browser, which should redirect to the website homepage.
Ending thoughts on the redirect 404 to homepage
404 errors are common and most users know that web pages undergo changes and are not perfect.
However, if the 404 errors are causing customer dissatisfaction, especially with pages that attract high traffic, then redirecting users to comparable content, through links on the homepage, is the best recommendation.
Redirect 404 to homepage in two ways:
- Create a new php file with the appropriate code and upload it to the theme folder.
- If the website is suffering from a loss of traffic due to too many 404 error pages, then redirect all 404 pages to the homepage by using a redirection plugin.
If you enjoyed reading this article on how to redirect 404 to homepage, you should check out this one about how to use toolset.
We also wrote about a few related subjects like
how to downgrade WordPress,
how to install google tag manager on WordPress,
how to embed a google form in WordPress,
WordPress memory limit,
how to see the current WordPress version and
how to change the author in WordPress.