Table of Content

  • Redirect 404 page to WordPress home page.

Redirect 404 page to WordPress home page.

404 is special kind of HTTP error which specify that the resource you are looking is not available.

Causes of 404 Error :

Many times we are not aware of the 404 errors occurred. There are many causes of the 404 error,

  1. When 3rd party sites link your URL or resource incorrectly
  2. You have made some URL structure change without permanent redirect so your old links are ended on 404 page.
  3. Sometimes you don’t want to keep some old posts then you may delete it. After deletion any request made to see that post results in 404 error.

Redirect 404 page to WordPress home page :

404 error
WordPress handles such type of common error more efficiently.Whenever resource is not available then by default user landed on 404 page provided by user.

Steps performed :

  1. Go to WordPress dashboard –> Appearance –> Editor
  2. Now in the theme editor find 404.php template.
  3. Add following code in the template and save.

now when bad request is requested then page will automatically redirected to the home page.