Help with URL transform Rule 🇨🇱

Hi there :wave:

I need to create the following transform rule, but I am not able to make it work:

When:

  • User Agent contains “Android” (mobile devices) AND URL Query has “view=grid”

Then:

Replace (or rewrite) the Query string from “view=grid” to “view=list”.

For example:

I try it like this, but unfortunately it is not working:

What I am doing wrong ? Thanks for the help !

Try a “Contains” for Query String. Your link has multiple query strings. Keep in mind that your Rewrite is going to wipe them all out and replace it all with just “view=list”

You’d need the Rewrite to be dynamic with a RegEx something like this:
https://developers.cloudflare.com/rules/transform/url-rewrite/examples/#rewrite-path-of-moved-section-of-a-website

Thanks for the quick reply !

Unfortunately the regex_replace expression is not available in the free plan. Cloudflare returns:

2022-07-26_22-40

:sob:

Just found that this worked !!! Thank you very much @sdayman :fire::rocket::tada:

1 Like

Drat, you’re right. Biz and Ent only.

I don’t think there’s a way to swap out text without RegEx. There’s the concat function, but that only adds on. Offhand, I can’t think of a workaround for this.

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