How to setting up a custom branch domain with only one branch

Site name: priceless-volhard-14b73c

I would like to have two separate subdomains for my site: subdomain.mysite.com and stg.subdomain.mysite.com. My site currently does a single branch deploy from a branch called main and has auto-publish set to off. In this scenario the “published” build is prod and the most recent build of main is staging. This means I have two netlify endpoints:

  • Prod: priceless-volhard-14b73c.netlify.app
  • Stg: main–priceless-volhard-14b73c.netlify.app

What I have now is a CNAME structured like the following: subdomain.mysite.com -> priceless-volhard-14b73c.netlify.app which works great. What I tried to do was to set up stg.subdomain.mysite.com such that is references main--priceless-volhard-14b73c.netlify.app. I have tried creating the CNAME for stg-subdomain.mysite.com which did not work, and assumed creating stg.subdomain.mysite.com would also not work. Is it possible to set up a CNAME in this way?

Alternatively, I also considered setting up a custom domain for the branch, however with only one branch being deployed this option is greyed out to me. I typed up an idea of how to implement this as well below. Either implementation would work for me, I just want to have two subdomains pointing to the two netlify URLs I referenced above.

Hey @jlhasson

In order to have configure branch deploys, and branch subdomains, you need to have multiple branches.

Hey thanks yeah I figured that was the case for the branch subdomains. What about simply pointing a different CNAME to the main–priceless-volhard-14b73c.netlify.app URL than the one pointed to the priceless-volhard-14b73c.netlify.app URL? When I did this the CNAME pointed to main–priceless-volhard-14b73c.netlify.app seemed to be actually just pointing to priceless-volhard-14b73c.netlify.app.