How to configure DNS for GitHub Pages with custom subdomain?

Sat, Jul 18, 2020 2-minute read

The case

The case is as follows: I bought a domain. From this domain I configured an access to my website hosted on GitHub Pages. I want to serve other static page hosted on GitHub Pages and I want to have an access to this site through the custom subdomain based on my main domain. Configuration have to support enforcing HTTPS connections.


I have to configure CNAME file in repo like it was presented in documentation. Then I have to add new CNAME DNS record for my subdomain. Target in CNAME record have to point to (your-github-username), so in my case:

DNS record configuration

Then I was able to access to my new website by subdomain based on my main domain and enforce HTTPS connection to my new website.

Helpful sources


Thank you for visiting my website. I hope you enjoyed content which I prepared and learned something valuable from it. If you want to be informed about my next entries or occasionally get a message with a collection of some interesting links, please subscribe to my newsletter. I will be extremely pleased if you do this and join my community!

  • By clicking button below you agree to send you news from my blog, about my products and services. Above data are stored in Mailchimp and I do not share them to anyone. More info you can find in privacy policy.