Created
July 4, 2018 15:42
-
-
Save shepardm7/c856e761e9d3203f29df2b5d3c56cd8b to your computer and use it in GitHub Desktop.
How to automatically redirect http to https using javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loc = window.location.href+''; | |
if (loc.indexOf('http://')==0){ | |
window.location.href = loc.replace('http://','https://'); | |
} | |
//Source: https://stackoverflow.com/questions/4954768/automatic-redirection-to-https |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment