I have two projects on Github which both belong to the same Github "organization". Both projects have a gh-pages
branch which I'd like to serve under a custom subdomain. Configuring this correctly turns out to be quite hard, despite several Github documentation pages and helpful SO posts such as this one.
Here's what I have so far:
DNS Configuration
org.github.io.
org.github.io.
nslookup proj1.mydomain.com
returns:
Name: github.map.fastly.net
Address: 185.31.17.133
Aliases: proj1.mydomain.com
org.github.io
For proj2
, the alias says proj2
.
Github Setup
org/proj1
has a gh-pages
branch with a CNAME
file on it that says
proj1.mydomain.com
For proj2
, the CNAME file says proj2...
as well.
The organization has no special configuration or website, as we only care about the two projects.
Behavior
org.github.io/proj1/
: Content OK, but no redirect to proj1.mydomain.com
org.github.io/proj2/
: Content OK, but no redirect to proj2.mydomain.com
proj1.mydomain.com
: works OKproj2.mydomain.com
: works OKHow can I get that redirect to work as it should?
The apex domain mydomain.com
(just like www.mydomain.com
) is not involved in all of this; I currently have subdomains and Github projects only. Also, I do see the Your site is published at http://proj1.mydomain.com
message as suggested by the Github docs.
I have the same problem with one subdomain and the last paragraph on this page seems to close the door to a solution for a natural redirect.
Maybe some javascript can do the trick to redirect from user.github.io/project
to project.mydomain.com
. You just have to be sure to include a canonical link
in you head to avoid the duplicate content drawback.