Learn how to use Bulk Redirects to redirect your *.pages.dev subdomain to your custom domain.
You may want to do this to ensure that your site's content is served only on the custom domain, and not the <project>.pages.dev site automatically generated on your first Pages deployment.
To redirect a <project>.pages.dev subdomain to your custom domain:
-
In the Cloudflare dashboard, go to the Workers & Pages page.
Go to Workers & Pages ↗ -
Select your Pages project.
-
Go to Custom domains and make sure that your custom domain is listed. If it is not, add it by selecting Set up a custom domain.
-
In the Cloudflare dashboard, go to the Bulk Redirects page.
Go to Bulk redirects ↗ -
Create a bulk redirect list modeled after the following (replacing the values as appropriate):
Source URL Target URL Status Parameters <project>.pages.devhttps://example.com301- Preserve query string
- Subpath matching
- Preserve path suffix
- Include subdomains
-
Create a bulk redirect rule using the list you just created.
To test that your redirect worked, go to your <project>.pages.dev domain. If the URL is now set to your custom domain, then the rule has propagated.