How to redirect 404 errors to my WordPress home page index.php?

Create a new file named 404.php and enter the following code:

 
<?php
   header("Status: 301 Moved Permanently");
   header("Location:http://www.xxxxxx.tld");
?>
 
Replace www.xxxxxx.tld with your domain name and upload the 404.php file to your current WordPress themes folder located in: /wp-content/themes/
  • 52 Users Found This Useful
Was this answer helpful?

Related Articles

Bots hitting xmlrpc.php and causing a high load

Due to a security issue in earlier versions of WordPress that allowed posting from xmlrpc.php,...

Caching plugin for WordPress?

  Since we use LiteSpeed Web Server, we recommend using the LiteSpeed Cache plugin....

Can I use the WordPress command line interface or WP-CLI?

Yes! The WordPress command line interface or better known as WP-CLI is installed by default on...

Changed theme and now cannot access WordPress site or wp-admin

If your theme has an issue and WordPress only shows a blank (white) page and you need to change...

High resource usage from /wp-admin/admin-ajax.php

If you are seeing a high amount of resource usage due to /wp-admin/admin-ajax.php, it could most...

Powered by WHMCompleteSolution