Tutorials

How to redirect 404 pages to the home page in WordPress

redirect 404 pages to the home page

Looking for a way to redirect 404 pages to the home page in your WordPress website. Here in this article, we will guide you to redirect all of your 404 pages to your homepage in WordPress.

Redirect pages are the broken pages or non-existing pages of your website. So when the user lands on any 404 pages they leave the website instantly. It will increase your website’s bounce rate as well as it will create a negative impact on your website. On the other hand, if you redirect them to your home page you can reduce the bounce rate as well as you can get a chance to express your services to the users.

Why it is important to redirect 404 pages to the homepage

The best practice for 404 pages is to create a custom 404 page so when a user lands on 404 pages they will see the custom page. You can create a custom 404 as your own design and display information as you want. But if you are not interested or don’t have enough time to create a custom 404 page then the easiest solution for you is to redirect all the pages to your homepage.

It will help you to create audience engagement and you can make your visitors into your customers. You can also redirect them to another page of your website. So let’s see how to redirect 404 pages to the homepage.

Redirect 404 pages to the home page in WordPress

You can redirect 404 pages to your home page using a plugin or manually. There are different plugins that provide these features. Here we will cover up both methods.

Redirect 404 pages with a plugin

Here in this tutorial, we are using the Redirection WordPress plugin. Install and activate the plugin and then set up the plugin. Go to Tools > Redirection to set up the plugin.redirect 404 pages to the home page

After finishing setup up properly you can redirect your pages.  First, you need to add a source URL. Here you can add your 404-page link. After that, you need to add the query parameter. There are three different query parameters –

  • Exact match in any order
  • Ignore all parameters
  • Ignore and pass parameters to the target

At last, you need to add the target URL where the page will redirect and set the group.

redirect 404 pages to the home page

This will redirect your page to your targeted page. You can see all of your redirect page lists from here too.

Redirect 404 pages to the home page manually

This process needs to add code snippets to your website. If you are not familiar with adding code snippets then you can see this tutorial How to copy & paste code snippets into WordPress

Now you need to create a file in your website theme folder. Create a file as 404.php. Log in with your website with an FTP client to edit your created file. Open up the 404.php file and this little code snippet there.

<?php

header("HTTP/1.1 301 Moved Permanently");

header("Location: ".get_bloginfo('url'));

exit();

?>

Now re-upload the file in your website theme folder and it will redirect your 404 pages to your home page.

Wrapping Up

Following the process, you will be able to redirect your 404 pages to your home page. You can see our other articles to learn How to add special characters to WordPress

How to display breadcrumb navigation links in WordPress

We hope this article will help you. If you like this article please like our Facebook Page to stay connected.

You Might Also Like