Adding custom branch aliases
In this tutorial, you will learn how to add a custom branch alias (staging.example.com
) that will point to a specific branch (staging
) on your pages project.
Firstly, make sure that you’ve made a commit on the branch you’d like to set up an alias for - this will prompt a build in pages.
Next, add a custom domain under your Pages project for staging.example.com
.
To do this:
- Go to Pages in the dashboard.
- Select your project.
- Click on Custom domains and then Setup a custom domain
- Input the domain you’d like to use as the custom branch alias, such as
staging.example.com
- Click on Continue and then Activate domain
After doing this, you’ll want to go into the
DNS settings for the
example.com
zone and change the staging
record’s value to include our branch alias.
In this instance, we’ll want to change your-project.pages.dev
to staging.your-project.pages.dev
.
Now the staging
branch of your Pages project will be available on staging.example.com
.