Page rule to redirect rule migration (advanced)

Hi. I saw Page Rules are planned to be deprecated and wanted to create my new rule as a Redirect Rule.

The Page Rule would work as intended using the following syntax:

Match On:

Redirect To:

I cannot get anything to work to accomplish the same using a Redirect Rule. I found a similar suggesting using concat and http.request.uri.path, but this is not applicable in my scenario.

Thank you!

Yes, Cloudflare has said that for a while and they actually might deprecate it at some point, but I would not assume this is going to happen any time soon, meaning in the next half a year or year.

Personally, I would go with the page rule.

Of course, at some point you might have to migrate, but they might also deprecate everything else :slight_smile:

1 Like

@sandro , thanks for the response. Should I assume based on your response that the same functionality is not possible with a Redirect Rule?

If you are on a Business plan, you could try to play with regex_replace. That may work, but Iā€™d still argue page rules are more elegant for your use case.

This would be the equivalent redirect rule:

(starts_with(http.request.uri, "/page1/?param_abc="))

concat("", substring(http.request.uri, 18))

Will immediately break with /page1/?xxx=yyy&param_abc=

Why? That matches neither the original page rule nor the redirect rule.

Because you never have a guarantee which parameters are provided and in which order.

There simply is no point in implementing this via a hack with concat if you have an elegant solution with page rules - /page1/?*param_abc=*

In short, it is possible to somewhat implement that and the OP already referred to it in his original posting, but that would be a very static implementation and a single character will break the whole thing.

If the OP is on a Business plan, he could still implement it, but again, page rules are the easier, more elegant, and more stable approach and work on all plans.

1 Like

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