Redirect Blogger 404 Error (Page Not Found) To Homepage

A 404 error page tells you and search engines that a page is not found by displaying a text similar to "Sorry, the page you were looking for in this blog does not exist.". This may happen because you have changed your URLs over time, either removed a few pages when you overhauled your design, or a visitor may have accidentally misspelled an URL nonexistent in your blog, so it automatically redirects to the 404 error page (page not found).

Most likely, this will not make a good impression on the potential users of our blog. So, before the visitor clicks the back button or close the window/browser's tab, thus leaving our site forever, we may want to redirect 404 error in Blogger to a page, so that the visitor will continue reading our blog.
how to redirect blogger 404 error to homepage

One of the most used methods is the "meta refresh" but the problem with this method is that it breaks navigation (doesn't allow to return back). In this case, the best method is to use JavaScript about which I will go into more detail below.

Redirect Blogger 404 Error with JavaScript

Go to your Blogger dashboard, select your blog and click the Settings menu item > Search preferences > Custom Page Not Found.

redirect 404 error page in blogger to homepage

Copy and paste the following code inside the empty box:
Sorry, the page you're looking for in this blog does not exist.
You will be redirected to homepage shortly.
<script type = "text/javascript">
PNF_redirect = setTimeout(function() {
location.pathname= "/"
}, 5000);
The text which is going to be displayed can be modified as you want. If you are willing to redirect the 404 error page to another page other than home page, just replace pathname to href and / with the url of your page. Finally, the number 5000 which is the delay expressed in milliseconds, can be changed to other value if this is more convenient.

Next thing to do is to 'Save changes' and do a little test to check if the code works well. You can verify the 404 error page functionality by adding a random text at the end of your blog address - after pressing Enter, you should see the error page followed by a redirection after 5 seconds. That's it!


  1. Anonymous10/20/2013

    nice one!

  2. Thanks so much . i have one error with blogger .,but now i fixed them with that html javascript .
    Thanks :)

  3. Thank you! This is exactly what I needed after I deleted a bunch of old posts.

  4. thanks i am learning alot

  5. Actually i need this but i need other way. Someone???????

  6. I had apply, Thanks so much ^^

  7. Thank you so much! This was super helpful! :D

  8. thanks for this one. i used it in my blog

  9. Hello, can anyone help me? I have a custom 404 error page and I put it where this tutorial shows.

    But when I try to test it by adding something that doesn't exist after my domain, all I get is my page with the sidebar and all, but with no posts showing.

    What am I doing wrong?

  10. Thank for sharing. Please I have a similar problem in my blog which this doesn't solve. The problem is that when my site address was put in the address bar without the "WWW", The result will be:

    "404. That’s an error.

    The requested URL / was not found on this server. That’s all we know."

    It started since I have changed the domain name from the default
    I will be happy if you or anybody else can help me get rid of it.
    Thanks and Happy blogging.

  11. Thank you! It was helpful for me.

  12. thanks a lot working 100%


Although every comment is appreciated, due to an overwhelming amount of questions, I can no longer provide personalized help. Keep in mind that comments are moderated and may take some time to appear. All spam comments will be deleted. Thanks for understanding!