January 30, 2013

How to Redirect 404 Not Found Page to the Home Page in Blogger

Whenever a person lands on a web page that is either deleted or has no existence Blogger blogs usually display its common 404 not found error message i.e. “Sorry for the inconvenience, the page you are looking for has no existence”. First impression counts more than anything. A person would never desire to display not found error pages to his new visitors. Therefore, it is essential to redirect all 404 not found pages to the home page so users can easily get access to the content that is waiting for them. Since, Blogger do not support PHP, so we have to make use of JavaScript that does the job pretty nicely. Therefore, today in this article, we will learn How to Redirect All 404 Not Found Pages to Homepage in Blogger.

Before, we get on with our tutorial. Let us first discuss the true definition of not found pages. Most of the webmasters would be well aware of it but some beginners might get confused. Consider the following meaningful definition:

  • 404 Pages: The 404 not found error message is a form of standard HTTP response code, which indicates the client that the destination which he is looking for, is unable to interact with the server or has no existence. 
  • 301 Permanent Redirects:  URL redirection, also known as URL redirecting is a technique that allows a webmaster to forward his one domain to another domain through URL redirection, or making different web page available under many URLs
The Solution:
The solution is pretty much straightforward because there is no rocket science behind this technique. A small chuck of JavaScript coding would be doing the entire job. Consider the following instructions and apply them as mentioned below. 

Go To Blogger >> Settings >> Search Preference. Now from the list of functions Select Custom Not Found Page and paste the following JavaScript coding in the HTML Box. If some folks are using custom 404 error message, than they can add the following code at the end of the coding.

Sorry for the inconvenience, the page you are looking for has no existence.<script type = "text/javascript">
//Blogger 404 Redirect Powered by MyBloggerLab
BSPNF_redirect = setTimeout(function() {
location.pathname= "/"
}, 1000);
</script> 

  • 1000 is the delay time in microseconds. Anyone can change it. Changing the value to Zero (0) would redirect immediately without any delay. 
Save it and that’s it. Now whenever a visitor would hit a 404 page, it would automatically redirect him to your homepage. Note: This technique should be used only if lots of your indexed posts are deleted and they are getting high SERP ranking.  

19 comments:

  1. Great Post! Thanks for the information Faizan!

    ReplyDelete
  2. cool idea bro, thank you for sharing this with us !!


    www.pokharatech.com

    ReplyDelete
  3. Cool post. THis is something that many people will be looking out for

    ReplyDelete
  4. thanl you syed for this. I asked you once and u posted it!! Thanks a lot/
    !! :D

    ReplyDelete
  5. actually, i m using a custom 404 page. Check: mypremiumtricks.com/404

    well, can i add the script after that?

    ReplyDelete
  6. @syed faizan ali : please tell me if my blogger site have not any error or 404 error, so it is necessary to add these settings which you told about? Thanks

    ReplyDelete
    Replies
    1. No, if you're not getting any errors than there is no need to use this technique!

      Delete
  7. hello syed if i change the value of / in the below line with any blog adress then will it redirect to any other site
    location.pathname= "/"

    ReplyDelete
    Replies
    1. If You Don't Want to Redirect it to Home Page and Desire to redirect to any specific Page than Use This Code:


      Sorry for the inconvenience, the page you are looking for has no existence.
      <script type = "text/javascript">
      //Blogger 404 Redirect Powered by MyBloggerLab
      BSPNF_redirect = setTimeout(function() {
      location.href= "http://www.mybloggerlab.com"
      }, 1000);
      </script>

      Delete
  8. Good Stuff Syed! I'm sure we'll see an increase in traffic. Thanks

    ReplyDelete
  9. Awesome Post Syed Bro...Keep It Up :D

    ReplyDelete
  10. Sorry for off topic. Do you have URL filter in Blogger commenting system? Please tell me.

    ReplyDelete
    Replies
    1. No, Sometimes it gets filers and sometime it won't. However, keep on marking them as SPAM so that Blogger can recognize Spam comments next time someone leaves the same comment!

      Delete
  11. I think my blog theme does not work. How do I reset operation 404 pages of html theme?
    Thank you!

    ReplyDelete
    Replies
    1. Recent your BLOG Widget located in Blogger Template Editor

      Delete
  12. I added Widget, however does not work. What could be the problem?

    ReplyDelete
    Replies
    1. You have to add it in Search engine preference area >> Not found

      Delete
  13. Great Tip Work.. my blog 35 404 page and now i follow your post and its work thnaks. bolegapakistan.blogspot.com

    ReplyDelete

We’re eager to see your comment. However, Please Keep in mind that all comments are moderated manually by our human reviewers according to our comment policy, and all the links are nofollow. Using Keywords in the name field area is forbidden. Let’s enjoy a personal and evocative conversation.