b-cdn.net hostname to your custom hostname, ensuring your content is only accessible through your own domain.
This is useful for:
- SEO purposes (avoiding duplicate content)
- Brand consistency
- Ensuring all traffic goes through your custom domain
Prerequisites
- A pull zone with a custom hostname already configured
- The custom hostname should have SSL enabled
Configuration
1
Open Edge Rules
Navigate to your pull zone and select Edge Rules from the side menu.
2
Add a new rule
Click Add Edge Rule to open the rule configuration page.
3
Configure the redirect action
Select Redirect To URL as the action.In the Redirect URL field, enter your custom URL with the Set the status code to 301 for a permanent redirect, or 302 for a temporary redirect.
{{path}} variable appended:The
{{path}} variable automatically includes the full request path and query string, ensuring all URLs redirect correctly.4
Add a trigger condition
Click Add Condition and configure:
Replace
yourzone with the name of your pull zone.5
Save the rule
Click Save Edge Rule to activate the redirect.
Example configuration
For a pull zone namedmycdn with a custom hostname cdn.example.com:
Before and after
HTTP vs HTTPS
Make sure to use the correct scheme in your redirect URL:- Use
https://if your custom hostname has SSL enabled (recommended) - Use
http://only if SSL is not configured
Related
- Custom Hostname - Set up a custom hostname for your pull zone
- SSL Setup - Configure SSL for your custom hostname
- Trigger Path Setup - Learn more about configuring trigger conditions
- Dynamic Variables - Full list of variables available in Edge Rules