Skip to content

Instantly share code, notes, and snippets.

@connor11528
Forked from konklone/ssl-redirect.html
Created October 18, 2017 19:59
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 connor11528/0c30cd13452bad58378769a2d46a006b to your computer and use it in GitHub Desktop.
Save connor11528/0c30cd13452bad58378769a2d46a006b to your computer and use it in GitHub Desktop.
Force a quick redirect to HTTPS on Github Pages for your domain (and only your domain)
<script>
var host = "YOURDOMAIN.github.io";
if ((host == window.location.host) && (window.location.protocol != "https:"))
window.location.protocol = "https";
</script>
@connor11528
Copy link
Author

Note that for this to work within my application I used let host = "www.mydomain.com"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment