The 404 error means the requested page doesn’t exist on the server. If you are getting multiple 404 errors on your WordPress site and you don’t have any specific page for 404. In this case, you can simply make 301 redirect all 404 requests to your website home page. To do this you don’t need to install the extra plugin on your site, A small PHP code will do this for you.
Redirect 404 Error Pages to Home
Got to your WordPress theme directory and edit 404.php file in your WordPress. Let’s add following small PHP script at top of the file. The first line in the script will make the redirection as 301 permanently.
Also you can replace .get_bloginfo(‘url’) with your website domain name to avoid extra request to WordPress to get domain name and make redirection more faster like below.
Finally, test the redirection in your browser window.