Page Rules migration guide·续2
How to replace:
- Create a configuration rule to turn off one or more security features:
- Email Obfuscation
- Hotlink Protection
- If required, create a WAF exception to skip one or more rules of WAF managed rulesets for requests coming from IP addresses in an allowlist.
- Turn off your existing Page Rule and validate the behavior of the rules you created.
- If your tests succeed, delete the existing Page Rule.
Caution
If you are still using WAF managed rules (previous version) or Rate Limiting (previous version), consider upgrading to the new versions of these products. It is not possible to turn off these older products using modern Rules features.
Migrate Disable Zaraz
Context:
You configured a Page Rule turning off Zaraz for all subdomains of example.com and the example.com domain itself:
- URL:
*example.com/* - Setting: Disable Zaraz
How to migrate:
- Create a configuration rule to turn off Zaraz for any hostname containing
example.com: - When incoming requests match: Custom filter expression
- Using the Expression Builder:
Hostname contains "example.com" - Using the Expression Editor:
(http.host contains "example.com")
- Using the Expression Builder:
- Then the settings are:
- Setting: Disable Zaraz
- Turn off your existing Page Rule and validate the behavior of the configuration rule you created.
- If your tests succeed, delete the existing Page Rule.
| Page Rules configuration | Migrate to a configuration rule |
|---|---|
![]() |
![]() |
Migrate Edge Cache TTL
Context:
You configured a Page Rule adjusting Edge Cache TTL for all subdomains of example.com and the example.com domain itself:
- URL:
*example.com/* - Setting: Edge Cache TTL
- Enter Edge Cache TTL: a day
How to migrate:
- Create a cache rule to adjust edge cache TTL for caching resources on Cloudflare edge to one day, for any hostname containing
example.com: - When incoming requests match: Custom filter expression
- Using the Expression Builder:
Hostname contains "example.com" - Using the Expression Editor:
(http.host contains "example.com")
- Using the Expression Builder:
- Then:
- Cache eligibility: Eligible for cache
- Setting: Edge TTL
- Ignore cache-control header and use this TTL
- Input time-to-live (TTL): 1 day
Caution
The default behavior of Cache Rules is different from Page Rules. Refer to Key differences for more information. 2. Turn off your existing Page Rule and validate the behavior of the cache rule you created. 3. If your tests succeed, delete the existing Page Rule.
| Page Rules configuration | Migrate to a cache rule |
|---|---|
![]() |
![]() |
Migrate Email Obfuscation
Context:
You configured a Page Rule turning off Email Obfuscation for all subdomains of example.com and the example.com domain itself:
- URL:
*example.com/* - Setting: Email Obfuscation
- Value: Off
How to migrate:
- Create a configuration rule to turn off Email Obfuscation for any hostname containing
example.com: - When incoming requests match: Custom filter expression
- Using the Expression Builder:
Hostname contains "example.com" - Using the Expression Editor:
(http.host contains "example.com")
- Using the Expression Builder:
- Then the settings are:
- Setting: Email Obfuscation
- Value: Off
- Turn off your existing Page Rule and validate the behavior of the configuration rule you created.
- If your tests succeed, delete the existing Page Rule.
| Page Rules configuration | Migrate to a configuration rule |
|---|---|
![]() |
![]() |
Migrate Forwarding URL
Example #1: Redirect www to root domain
Context:
You configured a Page Rule permanently redirecting www.example.com to example.com on all URI paths:
- URL:
www.example.com/* - Setting: Forwarding URL
- Select Status code: 301 - Permanent Redirect
- Destination URL:
https://example.com/$1
How to migrate:
- Create a single redirect to permanently redirect requests from
https://www.example.comtohttps://example.com. You can select the Redirect from WWW to Root rule template or enter the following rule configuration: - If incoming requests match: Wildcard pattern
- Request URL:
https://www.example.com/*
- Request URL:
- Then:
- Target URL:
https://example.com/${1} - Status code: 301
- Preserve query string: Enabled
- Target URL:
- Turn off your existing Page Rule and validate the behavior of the redirect you created.
- If your tests succeed, delete the existing Page Rule.
<details>
<summary>
Notes about the rule equivalence
</summary>
The provided example using Single Redirects is not an exact match for the previously existing Page Rule in the same example.
The exact equivalent would need to match both HTTP and HTTPS incoming requests, which you could achieve using a wildcard pattern like the following (notice the extra <code>*</code> after <code>http</code>):
- Request URL: <code>http://www.example.com/</code>
This would require you to also change the Target URL to use the second wildcard capture group instead of the first one (corresponding to the text captured by second <code>*</code> in the wildcard pattern above):
- Target URL: <code>https://example.com/${2}</code>
</details>
| Page Rules configuration | Migrate to a single redirect |
|---|---|
![]() |
![]() |
Example #2: Redirect all pages under old path to new path
Context:
You configured a Page Rule permanently redirecting example.com/old-path to example.com/new-path:
- URL:
example.com/old-path/* - Setting: Forwarding URL
- Select Status code: 301 - Permanent Redirect
- Destination URL:
https://example.com/new-path/$1
How to migrate:
- Create a single redirect to permanently redirect requests for
example.com/old-pathtoexample.com/new-path: - If incoming requests match: Wildcard pattern
- Request URL:
https://example.com/old-path/*
- Request URL:
- Then:
- Target URL:
https://example.com/new-path/${1} - Status code: 301
- Preserve query string: Enabled
- Target URL:
- Turn off your existing Page Rule and validate the behavior of the redirect you created.
- If your tests succeed, delete the existing Page Rule.
<details>
<summary>
Notes about the rule equivalence
</summary>
The provided example using Single Redirects is not an exact match for the previously existing Page Rule in the same example.
The exact equivalent would need to match both HTTP and HTTPS incoming requests, which you could achieve using a wildcard pattern like the following (notice the extra <code>*</code> after <code>http</code>):
- Request URL: <code>http://example.com/old-path/</code>
This would require you to also change the Target URL to use the second wildcard capture group instead of the first one (corresponding to the text captured by second <code>*</code> in the wildcard pattern above):
- Target URL: <code>https://example.com/new-path/${2}</code>
</details>
| Page Rules configuration | Migrate to a single redirect |
|---|---|
![]() |
![]() |
Migrate Host Header Override
Context:
You configured a Page Rule changing the Host HTTP header to example.saas-provider.com, for all requests addressed at any subdomain of example.com and the example.com domain itself:
- URL:
*example.com/* - Setting: Host Header Override
- Enter value:
example.saas-provider.com
How to migrate:
- Create an origin rule changing the
Hostheader toexample.saas-provider.comfor any hostname containingexample.com: - When incoming requests match: Custom filter expression
- Using the Expression Builder:
Hostname contains "example.com" - Using the Expression Editor:
(http.host contains "example.com")
- Using the Expression Builder:
- Then:
- Set origin parameters:
- Host Header > Rewrite to:
example.saas-provider.com
- Turn off your existing Page Rule and validate the behavior of the origin rule you created.
- If your tests succeed, delete the existing Page Rule.
| Page Rules configuration | Migrate to an origin rule |
|---|---|
![]() |
![]() |
Migrate IP Geolocation Header
Context:
You configured a Page Rule adding a CF-IPCountry HTTP header, for all requests addressed at any subdomain of example.com and the example.com domain itself:
- URL:
*example.com/* - Setting: IP Geolocation Header
- Value: On
How to migrate:
- Turn on the Add visitor location headers Managed Transform — a Transform Rules feature — to add the
CF-IPCountryand other location headers to all requests. - Turn off your existing Page Rule and validate the behavior of the Managed Transform.
- If your tests succeed, delete the existing Page Rule.
| Page Rules configuration | Migrate to a Managed Transform |
|---|---|
![]() |
![]() |
Migrate Opportunistic Encryption
Context:
You configured a Page Rule turning off Opportunistic Encryption for all subdomains of example.com and the example.com domain itself:
- URL:
*example.com/* - Setting: Opportunistic Encryption
- Value: Off
How to migrate:
- Create a configuration rule to turn off Opportunistic Encryption for any hostname containing
example.com: - When incoming requests match: Custom filter expression
- Using the Expression Builder:
Hostname contains "example.com" - Using the Expression Editor:
(http.host contains "example.com")
- Using the Expression Builder:
- Then the settings are:
- Setting: Opportunistic Encryption
- Value: Off
- Turn off your existing Page Rule and validate the behavior of the configuration rule you created.
- If your tests succeed, delete the existing Page Rule.
| Page Rules configuration | Migrate to a configuration rule |
|---|---|
![]() |
![]() |
Migrate Origin Cache Control
Context:
You configured a Page Rule turning off Origin Cache Control for all subdomains of example.com and the example.com domain itself:
- URL:
*example.com/* - Setting: Origin Cache Control
- Value: Off
How to migrate:
- Create a cache rule to determine edge cache behavior for any hostname containing
example.com: - When incoming requests match: Custom filter expression
- Using the Expression Builder:
Hostname contains "example.com" - Using the Expression Editor:
(http.host contains "example.com")
- Using the Expression Builder:
- Then:
- Cache eligibility: Eligible for cache
- Setting: Origin Cache Control
- Enable Origin Cache Control: Off
Caution
The default behavior of Cache Rules is different from Page Rules. Refer to Key differences for more information. 2. Turn off your existing Page Rule and validate the behavior of the cache rule you created. 3. If your tests succeed, delete the existing Page Rule.
| Page Rules configuration | Migrate to a cache rule |
|---|---|
![]() |
![]() |

