GitHub Pages: Redirect custom.domain.tld > user.github.io/project/
github-pages
Solution
If your `custom.domain.tld` currently points to `username.github.io`, you'll need to remove the CNAME file from your `user.github.io` repository's Master branch. Then, add the same `CNAME` file (with contents `custom.domain.tld`) to your Project repository's gh-pages branch. If you've already set up DNS properly for your `user.github.io` repository, then you won't need to make any changes there, the new CNAME settings on GitHub will take care of it.
One note: when you assign a custom domain (eg custom1.domain.tld) to a User Pages repository, all Project Pages in that User's account will inherit their respective `custom1.domain.tld/project` address, as well as any directly assigned domain (eg custom2.domain.tld).
For example, I have:
- www.nicksuch.com > nicksuch.github.io
- www.openkentucky.org > nicksuch.github.io/openkentucky (also accessible at www.nicksuch.com/openkentucky)
- DNS settings: CNAME - www > nicksuch.github.io (same for both domains, even though one is a User Page and the other is a Project Page)
More in GitHub's Setting up a custom domain with Pages.
Problem
As the subject says, I'd like to have my custom domain redirect to a specific project's gh-pages branch. I can easily get the standard behaviour: - custom.domain.tld > user.github.io (Where the static content lives in github.com/user/user.github.io/ master branch) - custom.domain.tld/project/ > user.github.io/project (Where the static content lives in github.com/project/ gh-pages branch) But I cannot figure out how to get this: - custom.domain.tld > user.github.io/project (Where the static content lives github.com/user/project/ gh-pages branch) I very much appreciate pointers.