(ง •̀_•́)ง Ming's blog

How to set up Namecheap domain and subdomain on GitHub Pages

Setting up a custom domain

According to the “configuring an apex domain” GitHub document and “Connect GitHub Pages to Your Namecheap Domain” by Paul J. Williams, there are two steps to use your custom domain for <username>.github.io:

  1. add 4 A records and a CNAME record on Namecheap (“Domain List” > “Advanced DNS” > Add those records under “Host Records”)
  2. add a CNAME file to your GitHub repository (you can add a file or do it through “Settings” > “Options” > Add a “Custom domain” under “GitHub Pages”)

You don’t have to purchase the SSL certificate from Namecheap or manually install one. Just check the “Enforce HTTPS” box under the “Custom domain” section on your repository.

Minor issues I faced

I have to uninstall my higher version of Visual Studio through Control Panel and run the execution file as an admin when installing BIND. I also follow the article “How to use BIND’s Domain Information Groper (dig) Tool” to select “Tools only” and add “C:\Program Files\ISC BIND 9\bin” to the system’s PATH afterwards.

Setting up a subdomain

In my case, I want to use my subdomain blog.mingyong.dev for another repository I have.

The process is the same as setting up a domain. Simply add a CName record to your Namecheap “Host Records” list with information as below:

Type Host Value TTL
CNAME Record blog <username>.github.io Automatic

and tell your repository you want to use blog.mingyong.dev as the custom domain.

Namecheap allows 150 subdomains per domain. I guess that means I can have another 148 projects.

#hosting