Ads (728x90)

Latest Post

Kesehatan

Tips

When any reader comes to your blog and unexpectedly does not get the searched post. Then error 404 occurs and a message appears on page "Sorry, the page you were looking for in this blog does not exist." by default. This may be a chance of loosing a blog reader. Because only few readers will think to move at home page or use search bar to search that particular content on your blog. I am sure many of readers will close the window and move again to search results. Before you loose an opportunity to make a new reader for blog you should redirect to a reader to home page when comes to a non existing page or post of your blog. There are already few solutions available for redirecting user to main page or home page, one the method is javascript and other is meta refresh/redirection. I personally do not like adding more javascripts to blog because it slows down the blog and reduces the blog performance. So for auto redirecting Blogger Page not found (Error 404) page to home page I am using meta refresh tag because it will load in template only when any reader reaches to a non-existing page or error 404 occurs and does not reduce the blog performance.

This code has 3 parts -
  1. Blogger error pageType tag
  2. Meta refresh/ redirection tag
  3. Custom error 404/ page not found message

1. Blogger error pageType tag
<b:if cond='data:blog.pageType == &quot;error_page&quot;'>
.....
//some code here
.....
</b:if>

2. Meta refresh/ redirection tag
<meta content='5;URL=http://www.your-blog-url.com' http-equiv='refresh'/>

3. Custom error 404/ page not found message
Oops! Page Does Not Exist. We are redirecting you to home page.


Now a complete code for error page is:
    <b:if cond='data:blog.pageType == &quot;error_page&quot;'>
Oops! Page does not exist. We are redirecting you to home page.
<meta content='5;URL=http://www.your-blog-url.com' http-equiv='refresh'/>
</b:if>

Note: You must change http://www.your-blog-url.com with your blog url.

How use this code in Blogger template?

  1. Go to Blogger Dashboard › Select a blog › Switch to Template tab › Edit HTML
  2. Now search for <head> tag
  3. And paste error page code just below head tag
  4. Save the template › Done
  5. You can test the error page code is working by opening following url.
  6. http://www.your-blog-url.com/404

Note: You must change http://www.your-blog-url.com with your blog url.

Other Related -
How to edit Blogger template

Happy Blogging! :)

Post a Comment