How to set up sub-domains for custom environments on Vercel

Current Setup

For custom environments on a project, can we have a sub-domain? For frontend and backend, we have a separate project for each.

The current domains are:

Goal

I want to have sub-domains for a test/staging environment like this:

Thanks in advance.

Hey, @oreststryhunov-9214! Welcome :waving_hand:

You can definitely create test.website-garden.com! You could either:

  • Create a test or staging branch in your Git repository
  • Go to your project Settings → Domains
  • Add test.website-garden.com as a custom domain
  • Click Edit on the domain and assign it to your test Git branch
  • Configure the CNAME record with your DNS provider
  • Push to the test branch and it will automatically deploy to test.website-garden.com

Or:

  • Go to project Settings → Environments
  • Create a new environment called “test” or “staging”
  • Set up branch tracking to automatically deploy your test branch
  • Attach the domain test.website-garden.com directly to the environment

Unfortunately, you cannot create custom subdomains on Vercel’s default .vercel.app domain. However, you have these alternatives:

  • Use the auto-generated preview URLs for your test branch (e.g., domain-management-test-abc123.vercel.app)
  • Add your own custom domain to the backend project (e.g., api.website-garden.com) and then create test.api.website-garden.com
  • Use the Preview Deployment Suffix feature (Pro add-on) to customize all preview URLs with your own domain
1 Like