Skip to content

Instantly share code, notes, and snippets.

@McPolemic
Created December 20, 2011 16:07
Show Gist options
  • Save McPolemic/1502100 to your computer and use it in GitHub Desktop.
Save McPolemic/1502100 to your computer and use it in GitHub Desktop.
A redirect page for IIS in order to enforce HTTPS
<script language="JavaScript">
<!-- begin hide
// Originally from http://raoulpop.com/2007/08/07/automatic-redirect-from-http-to-https/
function SSLRedirect()
{
if (window.location.protocol = "http:")
{
var oldURL = window.location.hostname + window.location.pathname;
var newURL = "https://" + oldURL;
window.location = newURL;
}
}
SSLRedirect();
// end hide -->
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment