Rules of "transform rules" setup asking

I have a website
I am looking for transform rules like if visitors type it then will be rewritten to

and if visitors type the automatic rewrite to adding ?w_id=123 at the end like

I have read the official article for a long time and have done some experiments but failed, so I am looking for help from there, hopefully, someone can help me or some hints?

Thanks a lot…

If you’re looking to rewrite, that should be doable with Transform Rules → URL Rewrite → Query.

1 Like


Thank you so much, looks great. but one more question is coming out, may you help?

I want to keep fixed content like and all following URLs without any changes.
like and such as all keep original URL, not need rewrite rule, how can I do this and keep your rewrite rule working together?

Thank you again.

Yes, that is possible :slightly_smiling_face:

Use the “Edit expression” button to switch to “manual”-mode:

Now edit the expression to include and not starts_with(http.request.uri.path, "/wp-admin"). The entire expression should now look like this:

The result is that any paths below /wp-admin will not have w_id=123 added to them.

I just wanted to mention that the current rewrite rule replaces the query string with w_id=123 instead of appending.

If you want to append w_id=123 to the current query string (therefore keeping existing parameters), change “Static” to “Dynamic” and set the value to concat (http.request.uri.query, "&w_id=123").

Though do note this will cause the query string to become ?&w_id=123 if the existing query string is empty - this should be treated as a valid query string but your URL parser may not like it.

I’m not sure I understand. Could you try rephrasing?

The URL Rewrite rule should look like this:


Hi Albert: the last one is not working,

Let me tell all exactly I need:

Running website looking for transform rules like if visitors not from one-third hostname: then will be rewritten to and also after above rules applied if all coming traffic is or then want automatic rewrite to adding ?w_id=123 at the end like and

meanwhile want to keep fixed content like and all following URLs without any changes because it’s backend entries like and such as all keep original URL, not need a rewrite rule

how can I do it?

What happens when a user visits Are they redirected to I need to understand your setup to make sure I provide the correct guidance :slightly_smiling_face:

This will also exclude any requests that have a Origin header containing

( eq ""
    not starts_with (
    not http.request.headers["origin"][0] contains ""

Thank you so much, after tested, your last rules looks great…

Happy new year to you.

@albert how to process below new rules:

and if I need when the end is ?wpam_id=x (x = any number) but excluds 5 then automatic rewritten to

I ask this just test founded some ?wpam_id=x not automatic rewritten to ?wpam_id=123, how can process it?

also while you type directly browser will say:

This page isn’t working redirected you too many times.


Now the rules like below:

We have a website:, want to set up the below rule but tried several times not working, anyone can help to bring some hints?


All coming traffic automatically adding ?wpam=1 at the URL end at the first time if no such end.

if the end already ?wpam=x (x is any number)then automaticlly covert ?wpam=x to ?wapm=1, but
?wpam=5 will remain original no need change.

After the first time converted then keep access original URL.

I’m not sure that is possible to do with Transform Rules. URL Rewrites are made to do simple transformations that do not require much logic. I’d recommend you take a look at Cloudflare Workers - they will let you do this, and more :slightly_smiling_face:

thank you, I will take a look at workers…

worker is really hard to me, I need learn the transform rules again.

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