Created
February 21, 2018 02:23
-
-
Save lkwatson/8bd6b154b0902d358b54f9ea013cb9e4 to your computer and use it in GitHub Desktop.
Enforce HTTPS
This file contains 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
if(window.location.host == "example.com") { | |
var host = "example.com"; | |
if ((host == window.location.host) && (window.location.protocol != "https:")) { | |
window.location.protocol = "https"; | |
} | |
}else{ | |
var host = "www.example.com"; | |
if ((host == window.location.host) && (window.location.protocol != "https:")) { | |
window.location.protocol = "https"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment