When any reader comes to your blog and unexpectedly does not get the searched post then error 404 (Page not found message) 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 losing a blog reader. Because only a few readers will think to move at home page or use the 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.
If Page to Found Redirect Reader to the Homepage
This code has 3 parts –
- Blogger error pageType tag
- Meta refresh tag
- Custom Error 404 (Page not found) message
1. Blogger error pageType tag
<b:if cond='data:blog.pageType == "error_page"'> ..... //some code here ..... </b:if>
2. Meta refresh/ redirection tag
<meta content='5;URL=https://your-blog-url' 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 of error page is:
<b:if cond='data:blog.pageType == "error_page"'> Oops! Page does not exist. We are redirecting you to home page. <meta content='5;URL=http://your-blog-url' http-equiv='refresh'/> </b:if>
Note: You must change http://your-blog-url with your blog URL.
How use this code in Blogger template?
- Go to Blogger Dashboard › Select a blog › Switch to Template tab › Edit HTML
- Now search for <head> tag
- And paste error page code just below head tag
- Save the template › Done
- You can test the error page code is working by opening following URL.
Note: You must change your-blog-URL with your blog URL.
Happy Blogging! :)
19 thoughts on “Auto Redirect to Homepage If Page Not Found on A Blogger Blog”
अच्छी जानकारी !!
@PooraN, Swagat hai!
Helpful, Thanks bhai
Most welcome :)
Thank u. Its really useful
Welcome Vishnu ji…
Woohoo, nice useful post … thankyou
Thanks a lot, this is the best technique i have ever seen and applied, it worked like a charm for me
Does Google delete the blog for using meta refresh?
thank you very much!!
wow, this was very helpful, thanks.
this have given me nightmare.
but i finally resolved it
Thanks it works
Thanks, It Work
Great article. It helped me a lot !!! Thanks
Niche tutorial, 100% works!!!
Thanks. I just tried this trick and very helpful.