Most of the beginners want to redirect blogger 404 error page to homepage. Actually there are so many reason to show up an error page in a website.
404 error page is an important things for search engine because if you don’t have a good error page it may harm on SEO. I don’t recommend to redirect error pages to homepage but many of readers asking me to show tricks. That’s why writing this tutorial about how to redirect blogger 404 error page to homepage with a simple JavaScript.
Whenever, by mistake, we or a user misspells an URL in-existent in our blog, it automatically redirects to the 404 error page. A message like this would appear:
“Sorry, the page you were looking for in this blog does not exist.”
And probably this will not make a good impression on the greatest potential users of our blog. Before the user clicks the back button or close the window/browser’s tab, thus leaving our site forever, we may want to redirect blogger 404 error page to a page, where are chances that the visitor will continue reading our blog.
One of the most used methods is the “meta refresh” but the problem with this method is that it breaks navigation. In this case, the best method is by using JavaScript which will be shown below.
Redirect Blogger 404 Error Page to Homepage
To redirect blogger 404 error page to home you don’t need to follow complicated things. Here’s the trick to redirect 404 error pages to homepage in blogger website.
- First, Go to your Blogger dashboard
- Click to Settings > Search preferences > Custom Page Not Found.
Copy and paste the following code:
The message which is going to be displayed can be edited as you want. If you are willing to redirect your blog 404 error page to another page other than your home page, just replace pathname to href and / with the URL of your page. And finally, the number 5000 is the delay expressed in milliseconds. You can edit any value if this is more convenient.
Final Thoughts
Text thing to do is to save all changes made in this section and do a little test to check if the code works well. You can enter a nonexistent URL on your blog, and see if the 404 error page added previously appears, following by a redirection after 5 seconds, That’s it! Please share this tutorial with other bloggers and let me know if you’ve any issue when applying it to your blog.