black traffic light with red light

How to redirect 404 error pages to homepage in Blogger?

I recently started using Blogger for a website. Yes, after so many years I decided to do so. Why? You may ask. Well.. to save money (it’s free). I did want to lose the domain but at the same time also wanted to have some (if not much) traffic to that domain/website. But when I tried doing so I got a lot of 404 error pages. The following is what I did in order to redirect 404 error pages in Blogger.

This step is actually quite simple and all you have to do is just copy and paste the following code in the blogger settings.

Here is the code:-

[php]<h1>Oops 404!</h1>
<br><b>The page you are looking for may have been renamed or does not exist in this server.</b>
<br><br><b>You will be redirected to homepage shortly.</b>
<script>
blogger_redirect = setTimeout(function() { location.pathname= "/" }, 5000);
</script>[/php]

Where to paste this?

  1. Open the blogger settings page.
  2. Scroll down to Errors and Redirects.
  3. Click on Custom 404.
  4. Copy the code given above and paste it into the custom 404 section of blogger.
  5. Click on the Save button.
  6. That’s all!

Now anyone who lands on a nonexistent page/post on your blogger website will be automatically redirected to the homepage. 5000 is the milliseconds after which the user will be redirected. You can increase or decrease the number as per your wish.

Similar Posts

Leave a Reply

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