Custom domains with Github pages
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.
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 https://acountName.github.io
and subsequent repositories (considered projects) will be a sub route, namely htpps://acountName.github.io/repositoryName
github.com/shushugah/shushugah.github.io => shushugah.github.io
github.com/shushugah/23. => shushugah.github.io/23
I purchased two custom domains from NameCheap, shushugah.com and 2Jews3Opinions.com. 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?
This leads to a side affect where shushugah.com correctly routes, but shushugah.com/23 redirects to 2Jews3Opinions.com because the github.com/shushugah/23
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 github.com/username/repo/settings
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, shushugah.com. If I had a repository named about
this could lead to errors and SEO issues. An Nginx configuration could prevent this kind of issue. 🤔