I’ve got myself confused with this and don’t fully understand the Netlify docs on subdomains. Appreciate any help.
I have my portfolio site at myportfolio .com
I’ve built some example sites that I would like to host on subdomains of myportfolio .com For example at example1.myportfolio .com example2.myportfolio .com and so on.
The sites are completely separate - one’s a consultant site, one’s a start up site etc
My portfolio site code is on GitHub and linked to Netlify and is working.
My domain is with Namecheap. I’ve set up my DNS in Netlify and pointed the name servers to Netlify - again it’s working fine.
I’d like to be able to host each of my example sites’ code in GitHub and link them to Netlify with each site linking to the correct subdomain.
I can’t work out how to set up a subdomain in Netlify.
I also can’t work out how best to set up in GitHub and then link to Netlify for these example sites (ie is it a branch of the main portfolio repo I should be using or a separate repo for each example site? Or something else?).
I’m not sure either of those links answer my question.
I’ve already set up my custom domain on my portfolio site using Netflix DNS. It’s working fine.
What I want to know now is how to set up multiple subdomains for the domain I’ve already set up and how they should be linked to GitHub (I think it’s a branch for each of them in GitHub rather than another separate repo).
Could you provide a link to your site, you mentioned in your initial post myportfolio.com and this is the site I was looking at. If you’re not able to access that site, then it must be another. If you could, pleaes provide the .netlify.app site name (for example sitename.netlify.app). Thanks!
I couldn’t see Branch Subdomains as an option in Domain Management because you have to create your Deploy Branch first.
So my flow was:
Create branch in GitHub with code.
Then in Netlify: Site configuration > Build & deploy > Continuous Deployment > Branches and deploy contexts and select either Let me add individual branches (and then add the name of your branch - note this will be used as the name of your subsequent subdomain.) or All (and I think your subdomain name will be whatever your branch name is in GitHub if you choose this) depending on your needs.
Netlify will now automatically build and deploy to branchname–domain.netlify.app
Now go to Domain Management > Branch Subdomains and Add new branch subdomain will now be a clickable button.
Select your branch from the dropdown and your custom subdomain (assuming you’ve already set up a custom domain) is created and immediately live.