Skip to content

Instantly share code, notes, and snippets.

@avicoder
Created July 23, 2016 07:17
Show Gist options
  • Save avicoder/3ebce7fe3f2b52d0b3e5f21cba90cd7e to your computer and use it in GitHub Desktop.
Save avicoder/3ebce7fe3f2b52d0b3e5f21cba90cd7e to your computer and use it in GitHub Desktop.
Redirect/enforce website to use secure connection.
<script type="text/javascript">
var enforce = "avicoder.me";
if ((enforce == window.location.host) && (window.location.protocol != "https:"))
window.location = window.location.toString().replace(/^http:/, "https:");
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment