Add a custom domain to a branch

Last updated Apr 21, 2026 In this guide, you will learn how to add a custom domain (staging.example.com) that will point to a specific branch (staging) on your Pages project.

This will allow you to have a custom domain that will always show the latest build for a specific branch on your Pages project.

Note

This setup is only supported when using a proxied Cloudflare DNS record.

If you attempt to follow this guide using an external DNS provider or an unproxied DNS record, your custom alias will be sent to the production branch of your Pages project.

First, make sure that you have a successful deployment on the branch you would like to set up a custom domain for.

Next, add a custom domain under your Pages project for your desired custom domain, for example, staging.example.com.

Follow the instructions below to access the custom domains overview in the Pages dashboard.

To do this:

  1. In the Cloudflare dashboard, go to the Workers & Pages page. Go to Workers & Pages ↗
  2. Select your Pages project.
  3. Select Custom domains > Setup a custom domain.
  4. Input the domain you would like to use, such as staging.example.com
  5. Select Continue > Activate domain

After selecting your custom domain, you will be asked to activate it.

After activating your custom domain, go to DNS ↗︎ for the example.com zone and find the CNAME record with the name staging and change the target to include your branch alias.

In this instance, change your-project.pages.dev to staging.your-project.pages.dev.

After activating your custom domain, change the CNAME target to include your branch name.

Now the staging branch of your Pages project will be available on staging.example.com.

Was this helpful?

YesNo

On this page

Add a custom domain to a branch - 图4Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/pages/how-to/custom-branch-aliases/#page","headline":"Add a custom domain to a branch","description":"Point a custom domain to a specific branch deployment of your Cloudflare Pages project.","url":"https://developers.cloudflare.com/pages/how-to/custom-branch-aliases/","inLanguage":"en","image":"https://developers.cloudflare.com/pages/how-to/custom-branch-aliases/og.png?v=08fe05a0c57a64cc","dateModified":"2026-04-21","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Learn how to deploy a static WordPress site using Cloudflare Pages. title: Deploy a static WordPress site image: https://developers.cloudflare.com/pages/how-to/deploy-a-wordpress-site/og.png?v=d2bca50ead333e6e


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/pages/llms.txt
Use this file to discover all available pages before exploring further.