How to Make WordPress 404 Pages Redirect to Homepage

Redirect Plugins

404 pages are part of each site, and some 404 pages are not properly setup. This may mislead users, thinking that the site no longer exists. So, it is necessary to direct users to the homepage.

404 pages

Different site guidance methods are different. But in WordPress here is a simple method. Open the 404.php file in WordPress theme directory, if it does not exist, you can create a blank file, and insert the following code into the file:

<pre> <? php

header (“HTTP / 1.1 301 Moved Permanently”);

header (“Location:” .get_bloginfo (‘URL’));

exit ();

?> </ pre>

Note that this case only exists in WordPress and is not necessarily valid for sites created with other

Content Management systems (CMS).

 

 

You May Also Like

About the Author: BW