Notes on Configuring Both Apex and www Subdomain for GitHub Pages
This is about configuring both apex and www subdomain for GitHub Pages.
- Configure GitHub Pages in the repository settings as described
- Set the custom domain as the apex domain, e.g.
example.com
- In DNS provider, add CNAME record for
www
-><usernamme>.github.io
(yes, just the domain name; it doesn’t include the repo name) - In DNS provider, add ANAME record for
example.com
-><usernamme>.github.io
- Set low TTL for testing
- Verify
curl https://example.com
returns content correctly - Verify
curl https://example.com
shows a redirect - Set a higher TTL