How to Force either HTTP or HTTPS on a Blogger Blog!
Recently, wait, actually, since the beginning of this blog, there has been one thing continuously bugging me related to one of the settings that blogger offers. Well, in the real beginning, there was an option for us to redirect our viewers to the HTTPS version only or the HTTP version only, but now that option HAS CHANGED!
Now what is available is that we can only either force people onto the HTTPS version of our blog or let them stay wherever they are whether it is the HTTP or HTTPS. So a partial amount of freedom has been taken away from us... to many people, it even feels like blogger doesn't care about us... well, no need to fuss any longer.
A few days ago, I was going through my blog and was frustrated because some people were saying they were unable to view some JS content, but I knew that the reason was that they were viewing it all over the HTTPS server.
Now, to change that, I sought for help, but unfortunately, people had only written posts and tutorials of how they could force HTTPS and that too through the way blogger allows it to happen. But, luckily, I have found the solution!
So, without further ado, let's find out how to force either HTTPS or even HTTP servers on your Blogspot blog so that you can either 'forcefully' provide people an encrypted connection, or allow 100% of your viewers to be able to view all of you JS and other scripts at all times!
Steps -
1. Open your Blogger Dashboard > Theme > (You might want to save a backup of your blog) > HTML editor.
2. Locate -
4. Save the template.
1. How to Force HTTPS
1. a) With Scripts
Though this is not the common way you would do this, you still can use a little code in your template to force people to view your site over an HTTPS server.Steps -
1. Open your Blogger Dashboard > Theme > (You might want to save a backup of your blog) > HTML editor.
2. Locate -
<header>
3. Now copy the script provided to you and paste it under the <header> tag -
4. Save the template.
1. Open your Blogger Dashboard > Settings > Basic.
2. You will have to scroll down the page a little and you will see a drop-down box, click it and make sure that you have selected Yes.
3. Save your changes
1. Open your Blogger Dashboard > Theme > (You might want to save a backup of your blog) > HTML editor.
2. Locate -
<script>
if (window.location.protocol == "http:") {
console.log("You are not connected with a secure connection.")
console.log("Reloading the page to a Secure Connection...")
window.location = document.URL.replace("http://", "https://");
}
if (window.location.protocol == "https:") {
console.log("You are connected with a secure connection.")
}
</script>
4. Save the template.
1. b) The Blogger Way
This is the method which Blogger intends for you to use and it is actually much easier too! -1. Open your Blogger Dashboard > Settings > Basic.
2. You will have to scroll down the page a little and you will see a drop-down box, click it and make sure that you have selected Yes.
3. Save your changes
2. How to Force HTTPThere isn't any way to force HTTP, or at least not a way that has been provided by blogger! To be able to easily force HTTP, you just have to follow these steps.
1. Open your Blogger Dashboard > Theme > (You might want to save a backup of your blog) > HTML editor.
2. Locate -
<header>
3. Now copy the script provided to you and paste it under the <header> tag -
<script>
if (window.location.protocol == "https:") {
console.log("You are not connected with the correct protocol.")
console.log("Reloading the page to the correct protocol...")
window.location = document.URL.replace("https://", "http://");
}
if (window.location.protocol == "http:") {
console.log("You are connected with the correct protocol.")
}
</script>
4. Save the template.
3. How to Force Neither
If you are okay with your viewers viewing their preferred version of your site, then you also have an option to leave it up to them. Here is how -
1. Open your Blogger Dashboard > Settings > Basic.
2. You will have to scroll down the page a little and you will see a drop-down box, click it and make sure that you have selected No.
3. Save your changes.
I hope that this little tutorial was easy enough and also did what you wanted it to do! If you have any doubts about anything, then feel free to ask and also share your experience! Stay Tuned!
1. Open your Blogger Dashboard > Settings > Basic.
2. You will have to scroll down the page a little and you will see a drop-down box, click it and make sure that you have selected No.
3. Save your changes.
I hope that this little tutorial was easy enough and also did what you wanted it to do! If you have any doubts about anything, then feel free to ask and also share your experience! Stay Tuned!
Post a Comment