This code has 3 parts –
- Blogger error pageType tag
- Meta refresh/ redirection 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=http://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 for 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! :)