How to Redirect 404 Error Page to Homepage in Blogger

404 error page (Page Not Found) is part of every website and blog. According to Wikipedia, “The 404 or Not Found error message is a HTTP standard response code indicating that the client was able to communicate with the server, but the server could not find what was requested.”

Redirect-404-Error-Page-to-Homepage

A non existing page on a website/blog will result to a 404 error page and this might give first timer a wrong impression about your blog. So the best solution to this type of situation is to redirect your blog 404 error page to your blog home page or a certain page on your blog. This can be done by adding a simple piece of JavaScript code to your blog. Follow the procedure outlined below to redirect your blogger error 404 page to homepage.

==> Log in to your Blogger Dashboard, then go to Settings >> Search Preferences >> Custom Page Not Found (Under Errors and redirections).

404-error-page-settings

==> Click on edit, paste the code below into the box and then Save changes


Sorry, the page you were looking for in this blog does not exist. You will be redirected to homepage shortly.
<script type = "text/javascript">
//Blogger 404 Redirect v1.0 by Olusegun(Justnaira.com)
JN_redirect = setTimeout(function() {
location.pathname= "/"
}, 5000);
</script>

Customizing the Redirection Code

  • • You can change the message on the top (i.e. Sorry, the page you were looking for in this blog does not exist. You will be redirected to homepage shortly) to anything you like
  • • The 5000 in the code represents delay in milliseconds. You can change the 5000 to any value. Changing the value to zero simply means your 404 error page will be redirected to your homepage or any desired page without any delay.
  • • If you are willing to redirect your blog 404 error page to another page other than your home page, just replace pathname to href and / to the url of the page.



Share this on:Share on Facebook0Tweet about this on TwitterShare on Google+1Pin on Pinterest0Share on StumbleUpon1Digg this

Become a fan on Facebook and us on twitter for our new updates.

7 Comments

  1. David
  2. jeon
      • jeon
  3. elusoji sodeeq

Leave a Reply