Which URLs should work for custom apex domains?


When hosting a site using GitHub Pages, where the CNAME in the repo is set to “example .com”, and DNS set up for both “example .com” and “www. example .com”, I’m wondering if all of the following URLs are expected to work:

https :// example .com
http :// example .com
https :// www.example .com
http :// www.example .com

(Sorry for the formatting, being a new user it limited the post to two links)

Thanks for any help you can provide,

It depends on which version of the domain you’ve set in your repository settings. GitHub Pages only generates an SSL certificate for the exact domain you’ve set in the repository settings page, so only one of the https variants will work. However, provided you’ve also set up the DNS records on both your apex domain and www subdomain, both http versions will work.

For example, if you’ve set your custom domain to example.com in the repository settings and set up the required DNS records on both the apex domain and www subdomains the following variants will work:


If you try to visit https://www.example.com/ then you’ll encounter a certificate error as GitHub didn’t generate an SSL certificate for that subdomain.