This is about configuring both apex and www subdomain for GitHub Pages.

  1. Configure GitHub Pages in the repository settings as described
  2. Set the custom domain as the apex domain, e.g. example.com
  3. In DNS provider, add CNAME record for www -> <usernamme>.github.io (yes, just the domain name; it doesn’t include the repo name)
  4. In DNS provider, add ANAME record for example.com -> <usernamme>.github.io
  5. Set low TTL for testing
  6. Verify curl https://example.com returns content correctly
  7. Verify curl https://example.com shows a redirect
  8. Set a higher TTL