Skip to Content

How to Redirect 404 Pages to Your Homepage

There are many reasons to redirect 404 pages to your homepage – and it’s super easy to do it without a plugin! While some prefer it, some don’t so it’s up to you as to how you want to handle it. Some reasons may include a rebranded site with a new domain and not wanting all posts moved, or just give a cleaner look. Whatever the reason there is an answer:

Step 1 –

Check to see if your theme has a file called 404.php

Step 2 – if it DOES, then remove all code from it and replace with this:

<?php wp_redirect(get_option('home')); ?>


If not then CREATE a 404.php by opening your text editor and placing the code above in it, save at a txt file.

Upload the file to your theme either in your File Manager (cpanel) or an FTP program like Filezilla. When it’s uploaded change the name from 404.txt to 404.php.

Done! All 404 pages will automatically redirect to your homepage now!