Webstick.blog logo Wordpress, Design, SEO, Speed blog

WordPress redirect 404 to homepage [2025] 💥

WordPress redirect 404 to homepage


You can reduce bounce rate by redirecting 404 pages to your home page. It will also give users the chance to explore other content on your site. We'll walk you through the steps to redirect your 404 page from WordPress to your homepage.


Advertisement

Divi Ad 680px


1. Redirect all 404 pages to the Home Page in Wordpress

This method requires you to add code into your WordPress files. We will need to modify the 404.php file in your theme. This piece of code will redirect all 404 pages to the homepage. To get access to your Wordpress files on the server/hosting we are going to connect with a filemanager like Cpanel (recommended) or FTP. If you don't have access you can install a filemanager in your Wordpress backend with this plugin.

You will find the 404.php on this location home/public_html/wp-content/themes/your-theme. Not all themes have this file though, if it is not there you will have to create your own 404.php page. The following code should be added to the 404.php file's first line:


<?php
    header('location:index.php');
?>

Instead of showing a page as 404, if a page isn't found, it will redirect them to your WordPress homepage.

2. Redirect 404 on a Wordpress website with a plugin

The "Redirection plugin" will be used. Download it, install and activate it. To use the searchbox, you can also visit "Plugins" and click "Add new". If you search for "Redirection", the plugin will be found at the first place. It's easy to install and activate the plugin without having to upload files.


Redirect 404 errors with Wordpress plugin


Redirection will monitor any 404s on your website. These can be accessed in the 404 log, by clicking on the 404s link in the top menu. From there you can redirect them to any page/post of your choice like the homepage for example.

3. Redirect all 404 pages to the Home Page with .htaccess

If you don't know where to find your .htaccess then read this short tutorial for it first. Then at the following code at the bottom of the .htaccess file's content.


RewriteEngine On
ErrorDocument 404 /index.php



Advertisement

Divi Ad 680px



Scroll up