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
| Setting | Value |
|---|---|
| Condition Type | Request URL |
| Match Type | Match Any |
| Condition Value | *://yourzone.b-cdn.net/* |
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:
| Setting | Value |
|---|---|
| Action | Redirect To URL |
| Redirect URL | https://cdn.example.com{{path}} |
| Status Code | 301 |
| Condition Type | Request URL |
| Condition Value | *://mycdn.b-cdn.net/* |
Before and after
| Original URL | Redirected URL |
|---|---|
https://mycdn.b-cdn.net/images/logo.png | https://cdn.example.com/images/logo.png |
https://mycdn.b-cdn.net/video.mp4?quality=high | https://cdn.example.com/video.mp4?quality=high |
https://mycdn.b-cdn.net/ | https://cdn.example.com/ |
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