Friday, May 27, 2022

mapping custom domains to github pages on multiple repositories

I was under the impression that one user can only map one custom domain to one repository with Github pages. But this post shows how to map multiple custom domains to multiple repositories for the same username -
https://deanattali.com/blog/multiple-github-pages-domains/

So, instead of Nettigritty's flaky domain redirection which doesn't work half the time, I've now used a meta redirect on another repo which has only index.html to redirect one of our websites. So the steps are:

  1. Add A records with IP addresses obtained by dig username.github.io
  2. Add CNAME record pointing to username.github.io (this is the tricky part which people miss out)
  3. Enable github pages in the Github repository settings
  4. Enable custom domain in the Github repository settings.
  5. After site works, enforce HTTPS in the Github repository settings - if necessary, wait 24 hours before doing this for DNS to propagate.


No comments:

Post a Comment