2

I am following the Github Pages tutorial. I thought I could have two domains: api.website.com and website.com, and the first is created via a folder called api in my main website folder where index.html is stored.

When I type in website.com as a subdomain, it says my site is ready to be published at http://website.com which is great. However I also want to have the domain http://api.website.com as an additional one, yet it overwrites the existing subdomain http://website.com. What am I doing wrong?

enter image description here

Steps I thought I would follow:

  1. https://help.github.com/articles/adding-or-removing-a-custom-domain-for-your-github-pages-site/
  2. https://help.github.com/articles/setting-up-a-custom-subdomain/
  3. https://medium.com/@LovettLovett/github-pages-godaddy-f0318c2f25a#.ae41mob6t
1
  1. Create another repository for github pages for example api.github.io .Which is accessible from github.com/yourusername/api.github.io

  2. Create separate branch with name gh-pages

  3. Create a CNAME file which contain your subdomain name for example api.example.com then deploy it to your repository OR simply add your subdomain into custom domain filed. Make sure the branch is gh-pages
  4. Configure CNAME records in your domain panel. For example host name is your subdomain api which point to your repository name api.github.io
  5. Configure A records which point to github pages server.
  6. Deploy your index.html and other file to your repository, make sure you push to gh-pages branch. For example git push origin gh-pages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.