Skip to content

Instantly share code, notes, and snippets.

@konklone
Last active January 2, 2024 15:09
Show Gist options
  • Star 39 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save konklone/9968713 to your computer and use it in GitHub Desktop.
Save konklone/9968713 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>
@Pravardhitha
Copy link

but where should i add the code. into my index.html?

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