InternetSmash

How to Redirect 404 Error Page to Homepage in Blogger

When browsing the web you might encounter a page that says “Sorry, the Page you were looking for in this blog does not exist”. This error is called “404 error page”, this page will appear when a visitor of a blog/site will try to visit a particular page that was already deleted or its URL was changed. When the Google crawler detects that there was a 404 error page on our blog it will try to delete it on Google search engine, assuming that the page was indexed. You may also use the Search Console if you try to look all the list of detected 404 error pages on your blog.

There is a big possibility that our visitors will leave our blog after seeing this kind of error, so one way to avoid to lose a potential visitors is by redirecting a 404 error page to the homepage, where visitors can see and read the latest posts of our blog before they leave.

Redirect 404 Error Page using JavaScript in Blogger

1. Go to your Blogger dashboard ->> Settings ->> Search preferences, then edit Custom Page Not Found.
2. Copy and paste the given codes below into empty text box and click Save Changes.

Sorry, the Page you were looking for in this blog does not exist.
</br>
You will redirected to homepage shortly.
<script type=”text/javascript”>
BSPNF_redirect = setTimeout(function() {
location.pathname= “/”
}, 5000);
</script>

You may also change the text that will appear on a 404 error page. If you created a 404 error page you may redirect onto that rather than redirecting to your homepage, just replace the pathname to href and / to the URL of the page. The redirection to the homepage will execute after 5 seconds and it is set on the above codes as 5000 milliseconds, you may change this according to your desired number. After setting anything you can now test by putting a non-existing url of your blog.

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *