Breaking News
Loading...
Saturday, 22 March 2014

Automatically Redirect 404 Error Pages To Your Homepage In Blogger

404 Error

If you are using Blogger, you should [in my opinion] definitely implement this tutorial! 404 error pages are nothing but pages on your blog that doesn't exist! (like sourcecrab.com/anything) Blogger gives us the freedom of displaying whatever we want on these error pages. We will simply add a small JavaScript code after which all of these 404 error pages will automatically redirect towards the homepage!
Update: Doing this won't harm your SEO, but it certainly won't do any good either. So implementing this is perfectly your choice and whatever you do here will only affect humans and not search engines! I confirmed this from Matt Cutts (head of Webspam, Google) himself!


How does Blogger handles 404 error pages?


By default, Blogger displays a simple statement "Sorry, the page you were looking for in this blog does not exist. Blogger displays that sentence along with the blog's title and sidebar [if present].

Probably not the best first impression you’d want to give a potential visitor. Before the user hits the back button and disappears forever, you might wanna redirect the page to your homepage [or any page for that matter] where the chances of the visitor staying is far greater. [Assuming you have awesome content!]

What most bloggers do?


Most of the bloggers out there waste their time designing these so-called "smart webpages" for 404 error! Blogger resource sites write huge tutorials on how to customize these pages! But all this for what!?

Think for it yourself. If a visitor lands on a page on your blog that doesn't exist, what would you like them to do!? Obviously, they should be taken to the homepage before they click the back button on their browser!

"Don't waste your time designing a page that will take your visitors to the homepage, directly take them to the homepage!"

Advantages of taking your visitors directly to the homepage!


This little hack will solve all your broken link problems! Let's say you deleted some old post or page on your blog. What if some visitor still has that link bookmarked and tries to access it!? Obviously, they will be disappointed to see no content at all! Instead, redirect them to the homepage and then they'll be happy as a clam to see more content!

Update: Some of my friends made a point that the visitors should have the right to know that the page doesn't exist and that they are being re-directed. And they are right! I mean, when the searched information is nowhere to be found on the landing page (homepage), the visitor might feel cheated.

To overcome this problem, I have yet another JS code that will make the visitors happy :) Have extended this tutorial with the same...
I hope I have convinced you that doing this is the right thing. Another good news is that this is way too easy to implement!

Holy pickles, here comes the real stuff!

Steps to implement


1. Go to your blogger dashboard --> Settings --> Search preferences.

2. Under Errors and redirections, there will be an option called "Custom Page Not Found". Click on Edit!

Blogger Search Preferences


3. In the box that appears, paste the following piece of code:
 <script type = "text/javascript">
window.location="http://www.sourcecrab.com";
</script>
Replace my blog's name with yours.

Blogger Custom Page Not Found

4. Hit Save changes and you're done!

Now whenever someone enters a wrong URL or tries to access a broken link, they will be automatically redirected to the homepage!

Update


You can also add this script instead of the one I provided above.

This JavaScript code will re-direct the visitors to the homepage, but after giving them a message that the they landed on page doesn't exist and that they are being re-directed. Click here for a demo.

In step 3, paste this code instead:
 Howdy! Looks like the page you're looking for doesn't exist!<br/>You will be redirected to the homepage in a few seconds!
<script type = "text/javascript">
BSPNF_redirect = setTimeout(function() {
location.pathname= "/"
}, 5000);
</script>
Code Credits: BS
Here, a message will be displayed: "Howdy! Looks like the page you're looking for doesn't exist! You will be redirected to the homepage in a few seconds!" [You can change it].

The visitor will be automatically re-directed to the homepage in 5 seconds! This will ensure that he/she has sufficient time to read the message. You can change this duration by editing the code highlighted in blue.

Let me know whether you decided to add the first script or the other...

0 comments:

Post a Comment

 
Toggle Footer