Search code examples
githubdnssubdomaincnamegithub-pages

Multiple GitHub Pages and custom domains via DNS


I want to have one user page and multiple project pages hosted by GitHub Pages but available under ONE custom domain (with subdomains for each GitHub Pages repository, of course). So my goals are as follows:

As of my current understanding, GitHub Pages do only allow ONE CNAME resource record for a page (both user pages and project pages) defined in the CNAME file in the root of a Git repository. I already tried out many things (playing around with DNS records and header redirects at my domain provider EUserv, but I can only access my GitHub user pages under one URL (http://blog.florianwolters.de). I am aware that DNS changes can take up until two days.

Can somebody explain to me, how I can achieve the goals described above? I can not believe that this is not possible but I am also no expert for DNS, etc.

If the above is not possible: What is your suggested workaround? I do want to access all my GitHub pages under one domain (and the subdomains of that domain).

Resources


Solution

  • You can do it. Notice that all DNS CNAME entries point to the same host.

    1: github.com/florianwolters/florianwolters.github.com

    CNAME file content: blog.florianwolters.de

    DNS CNAME: blog > florianwolters.github.com

    2: github.com/florianwolters/pear/tree/gh-pages

    CNAME file content: pear.florianwolters.de

    DNS CNAME: pear > florianwolters.github.com