Custom subdomains in GitHub project pages24 Aug 2015
If you host your website, blog or project pages in GitHub Pages, you might already be rolling your own custom domain. However, while there is plenty of information on how to set that up, what you might not know is that you can also set up a custom subdomain for your project pages.
So, if you’d like to publish your project page under
pjname.mydomain.com, even though it will live under
mydomain.com/pjname anyway, but you might just prefer it this way), simply follow these steps:
- Add a CNAME file to your project’s repository. The content of this file must be a single line specifying the bare subdomain for your project’s custom subdomain (e.g.
- In your DNS provider’s settings, create a new CNAME record that points
pjnameto either the root (usually denoted by
@), if you have previously set up an apex domain, or to
myusername.github.ioif you’ve set up a custom subdomain. It should look something like this:
And that’s it! After a few moments the changes should take effect. Thanks for reading!
If you have any questions or suggestions, be sure to reach me on Twitter.