404 error pages are normally created when ever you delete out any old post or you just update the posts changing the slugs so its old url just returns a error page. Well in blogger you are not able to change any slugs but if you delete your old post either you can redirect that page manually to your any other post by using the search preferences option officially in blogger or you can use the below script that will automatically redirect all your 404 error pages on blogger to your homepage. So if anyone has linked to your older post and he clicks on that link now if will not see any blank page instead of that he will be redirected to your homepage for some fresh content.
Redirecting 404 Pages using Blogger Custom Redirect
Well if you wanna redirect only few 404 pages than you can use the official custom redirect feature available in blogger that can solve out your problem. It can be used to redirect any older page to the newer updated one or any other blogger post.
- Visit Blogger > Settings > Search Preferences > Custom Redirects.
- Now just click on edit and and press New Redirect and enter the old URL and your New URL on which you wanna redirect.
- Now check mark on Permanent and press Save.
- Visit Blogger > Template > Edit HTML
- Now click on Expand Widget Templates and press
Ctrl+ Fand search for
- Now paste the below code right below the above code you just found.
<b:if cond='data:blog.pageType == "error_page"'>
- That’s it now just save your template and refresh any of your 404 error page to check if this script is working or not.
- The above is demo can be used as your demo too just change my domain name with your and see how that url will be redirected to your homepage automatically.
NoteDo not change that Sorry line else script will not work, that's the line blogger officially uses and that's what we are tracking and redirecting.
Now if you do not want too redirect your 404 pages to your homepage instead you want to redirect to some another website than just replace the blue line in above code with http://xxxxxxxx.com and that’s it will start redirecting your error pages to that domain name.
So I think this will pretty useful fro anyone who has many 404 error pages like my website as I faced some severe problem so I just have to remove many posts that are now 404 error pages so I have installed this script and its really a relief.
|Hey everyone we have launched our new YouTube Channel and discontinued our earlier channel, so make sure you subscribe to our new channel to stay updated with all the new videos uploaded.|