Custom domains with Github pages

Yonatan Miller

Github and EFF’s Lets Encrypt offer free HTTPS encryption for custom domains on their GitHub-pages (along with Cloudfare backed CDNs) an attractive solution for static pages.

Logo of “Let’s Encrypt” with a logo that looks like a lock with sunrise above it

I have two different Github repositories and want each of them to have their own unique domain. The way Github pages works, your user/organization Github page will be and subsequent repositories (considered projects) will be a sub route, namely htpps:// => =>

I purchased two custom domains from NameCheap, and I created CNAME file for each repository with the custom domains in each and inside NameCheap advanced DNS settings I configured them to point to Github’s IP addresses. Note how both custom domains share the same CNAME Record below?

A Records with values ranging from– and CNAME Record value of

This leads to a side affect where correctly routes, but redirects to because the is treated as a sub route.

As a last step, make sure Github forces the usage of HTTPS everywhere. This setting can be found in

Screenshot of settings panel for each Github repository

I am uncertain at this point, if this is an acceptable bug. Everytime I add a repository to GithubPages, I have to blacklist repo name from valid routes in my primary domain, If I had a repository named about this could lead to errors and SEO issues. An Nginx configuration could prevent this kind of issue. 🤔

Yonatan Miller

Written by

Programmer 💻🔥 Articles are my own, sorta ☕ Writing for pleasure and advocacy.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade