Search code examples
dnssubdomaingithub-pagescname

Github user page and project page in different subdomains of the same domain?


So what I am trying to get done is:

  1. Have UserName/username.github.io served at https://subdomain.domain.com
  2. Have Username/project served at https://project.domain.com

I have done these things:

  1. Put a DNS record in cpanel: subdomain CNAME username.github.io.
  2. Put a CNAME file subdomain.domain.com in UserName/username.github.io repo.
  3. Put a CNAME file project.domain.com in UserName/project repo.

Now number 1 works: https://subdomain.domain.com is reachable and serves the content correctly.

However 2 does not work: DNS check fails:

Your site's DNS settings are using a custom subdomain, project.domain.com, that's set up as an A record. 
We recommend you change this to a CNAME record pointing at [YOUR USERNAME].github.io. 
For more information, see Learn more (InvalidARecordError). 
We recommend you change this to a CNAME record pointing to subdomain.domain.com.

Now if I follow the suggestion then I get UserName/project served at subdomain.domain.com/project correctly, but that is not what I want.

I followed this question, of which this one should be a duplicate... but I guess there is something different, or something I am missing.

How do I fix this ?


Solution

  • Trying to put another DNS CNAME record: project CNAME username.github.io.

    It should work.