Sunday, November 08, 2015

How To Redirect A Blogger Blog From HTTP To HTTPS?
Today, we are going to do a significant change in your blogger blog. We will redirect it from HTTP:// URL to HTTPS:// URL. This can bring some more traffic from search engine, and it is also SEO-friendly. Maybe, you have read our recent post that was on the major fixed disadvantages of blogger's HTTPS feature and that, now blogger supports HTTPS.

HTTP To HTTPS Blogger

The biggest problem of HTTPS that some blogs and developers had reported is- Redirection issue. Whenever, you enable SSL certificate for your blog from your blog's dashboard, you may notice that both, http://your-blog.blogspot.com and https://your-blog.blogspot.com are available. How can this be non-SEO friendly? - Maybe, this question has got risen in your mind already. This is because, Google will then index both URLs of your blog and then what? Your content will be in two URLs, and this will lead you a massive panda penalty that can be very dangerous for your blog, and it's traffic.

I had marked this issue on this post as fixed. On our recent post, I had also told you that what is 301 redirection- which is permanent redirection and what is 302 redirection- which can be helpful if you want to redirect a URL to a URL temporarily.

Now, we are going to help you to solve the following problems of HTTPS:
  1. Redirect your blog from HTTP to HTTPS; 
  2. Prevent both, HTTP and HTTPS URL from being indexed; 
  3. Make your blog safe from Panda penalty; 
  4. A slight increase in traffic from Google [Not Myth].
[button href='http://thebloggingresearcher.blogspot.com']See The Demo Of Redirection[/button]
The disadvantage of the tutorial we are going to share is- Your blog will not get redirected from HTTP to HTTPS if the visitor have disabled javascript in the browser. Now, what you can do is- Show notification to the user, forcing him/her to enable javascript. We will do this in our next tutorial in series.

How To Redirect Your Blog From HTTP To HTTPS?

We will do this using a little and easy-to-understand chunk of JavaScript. This piece of JavaScript can quickly redirect your blogger blog if it is being browsed using blog's HTTP URL. 

Note: - Doing the steps mentioned below, you are also preventing your blog from being penalized by Panda penalty.

Steps:
  1. Go to Blogger > Template > Edit HTML
  2. Now, search for "<head>" in your template.
  3. Below it, paste the following chunk of code:
  4. <link href='https://your-blog.blogspot.com' rel='canonical'/><script type='text/javascript'>
    function check_secure() {
    var secssl = /^https/i;
    var blog = document.location.hostname;
    var slug = document.location.pathname;
    var subs = window.location.search;
    if (!window.location.origin.match(secssl)) {
    window.location = "https://" + blog + slug + subs;
    }
    }
    check_secure();
    </script>
    Note :- The bolded code above will make your blog safe from being penalized by Google according to its algorithm, Panda. The URL in the bolded code will help Google understand that what is the main URL of your blog and where to pass the link juice.
  5. Change the orange color highlighted words with your blog's URL. (Important: Don't change HTTPS:// before the URL)
  6. Now, save your template and you are done!
Important: - Find this code that is given below and make sure that the code I have given above is placed above the following code:
<b:include data='blog' name='all-head-content'/>

Conclusion

Now, you have redirected your blogger blog from HTTP URL to HTTPS URL and, you also have made your blog safe from Google's Panda penalty. I hope, you will get a slight increase in your blog's traffic now because Google gives a better position to SSL-secured sites than non-SSL-secured sites. If you have any questions about the above script or HTTPS, feel free to comment below. 

And you know, that they script I have given above is JavaScript. So, it won't help you to redirect your blog from HTTP to HTTPS if the visitor has blocked JavaScript in his browser. For solving this issue, I am working on another coding to show a notification when the viewer is viewing your blog and disabled javascript. Peace! :)