I have a GitHub pages set up with a custom domain.
I have some project pages which I would like to be available at project.domain.com, in addition to being available at domain.com/project.
Setting up the project repository with a CNAME file, and adding a CNAME record to the dns will make project.domain.com work, but redirects domain.com/project to project.domain.com.
Is there a way to have both URLs serve the same project page, without either redirecting to the other?
This question asks the opposite, how to automatically redirect from a subpath to a subdomain, but both options (A records or CNAME records) don't work for me.
2
votes
1 Answers
1
votes
You cannot have both.
You project repository is served as a folder of :
username.github.io
->username.github.io/projectname
- or
domain.com
->domain.com/project
, if you add aCNAME
fordomain.com
inusername.github.io
If you add a CNAME in a project repository, an automatic redirection is applied in accordance with this CNAME content. In your case project.domain.com
.