Migrating from Page Rules to Dynamic Redirects

I currently have a Page Rule like the following:

URL: www.example.com/*
Pick a Setting: Forwarding URL
Select status code: 301 - Permanent Redirect
Enter destination URL: https://example.com/$1

This essentially strips the www. from the domain but maintains all other parts of it.

I would like to migrate the rule to the new Dynamic Redirects package as I noted that Cloudflare indicates they expect to eventually decommission the Page Rules. I am running into a bit of an issue with what the proper format for the destination Expression is.

When incoming requests match…
Field: Hostname
Operator: equals
Value: www.example.com

Type: Dynamic
Status code: 301
Preserve query string: checked

I couldn’t find anything in the docs to assist with this issue.

concat("https://example.com", http.request.uri.path) for the Expression works for my site.

This seems to work! Is there a good site with documentation/syntax on forming these rules?

You can find what’s available here: Fields reference · Cloudflare Ruleset Engine docs

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.