Ruixiang Du

Setting Up Two Custom Domains for Github Pages

According to offical tutorial, “You can only have one custom domain for any given set of Pages. If you want multiple domains to point to the same Pages, you will need to use a service that can redirect the other domains to your Pages domain.”

This post gives an example about how to do the redirection with two domain names from namecheap and respectively.

My personal feeling is that namecheap provides better user experience in managing your domains. You can get what you want very easily and their help page is indeed very helpful and can save you some time searching on the Internet. also has a nice-looking management interface, but it seems they don’t provide as many functionalities as namecheap does. I can get the redirection working without any pain but I failed to do the same thing on (I’m not a person who is familiar with web development nor network. If you are one, maybe you could ignore this comment.)

In this example, I use domainA(“” from as the main method to access my github pages and use domainB(“” from namecheap) to do the redirection.

  • Add a CNAME file, which includes your primary domain name, to your github page repository

  • On namecheap: From the “Host Management” section on the left side, go to “All Host Records”. Add just one record:

    • HOST NAME: @;
    • RECORD TYPE:redirect; TTL:1800

  • On Go to DNS Record and add two records:

    • Type:A;; Answer:; TTL:1800 -Type:A;; Answer:; TTL:1800

After finishing the above 3 three steps, you should be all set. Wait for some time and check if both of the domains work properly.