Page Rules are deprecated

Today I visit Cloudflare and see that note “Page Rules are deprecated. You should consider alternative Rules options due to their enhanced configurability. Refer to the migration guide for details.”

I have some rule like that
abc.com/*
Forwarding URL 301
def.com/$1

I looked for alternative methods but none of them allowed me to use the characters * and $1so they can match the corresponding paths.


And I don’t know if my old rules will be lost after cloudflare’s update?
I am very worried about this problem and hope to get help about it

The new Rules Engiine doesn’t (yet?) have wildcards. To redirect using Redirect Rules, follow this guide…

The document gives migration instructions for a variety of Page Rules configurations.

Hi sjr.
Thank you for your help but I have a problem with remove string from http.request.uri.path
For example i need do this rule
URL full contains abc.com/photo/ → Diamic → concat(“cdn.abc.com/”, http.request.uri.path)

With abc.com/photo/abc.jpg
The result will be: cdn.abc.com/photo/abc.jpg
But I need: cdn.abc.com/abc.jpg
This mean I need remove /photo from http.request.uri.path

I tried for many times but I do not found any replace function with Cloudflare Expression
For the Page Rules It so easy by set a page rule like that
abc.com/photo/*
cnd.abc.com/$1

Cool I found substring and I fix it.
The /photo/ have 7 charactors and I need remove 7 charactors from http.request.uri.path. The last queries is: concat(“https://onechamptee.com/”,substring(http.request.uri.path,7))

2 Likes

Yes, concat + substring is the way to go until we release wildcards for Ruleset Engine later this year: Dynamic Wildcard Redirect Rule - #2 by ncano. We are working on adding more examples like this to the migration guide this month.

2 Likes

Will we get a “Cache Everything” option similar to what we had before under Page Rules? I’m not confident that all of my assets and the full html of my pages are actually getting cached under the new Cache Rules.

See the migration guide here for cache everything…

2 Likes