Skip to content

Instantly share code, notes, and snippets.

@dtanham
Created March 2, 2015 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtanham/3ea5b1f1ff086d26ec58 to your computer and use it in GitHub Desktop.
Save dtanham/3ea5b1f1ff086d26ec58 to your computer and use it in GitHub Desktop.
JS Redirect to HTTPS
if (window.location.href.indexOf("https://") != 0 && window.location.href.indexOf("http://localhost") == -1) {
window.location.href = window.location.href.replace("http://", "https://");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment