Skip to content

Instantly share code, notes, and snippets.

@ajaidanial
Forked from konklone/ssl-redirect.html
Created November 21, 2020 21:38
Show Gist options
  • Save ajaidanial/b8f0f7cdaf2d22af4fd49ec3af0ebead to your computer and use it in GitHub Desktop.
Save ajaidanial/b8f0f7cdaf2d22af4fd49ec3af0ebead 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment