Page Rule : Forwarding URL but preserve utm query strings?


#1

I have a page rule to re-write “https://screen.pansift.com/” to “https://sim.pansift.com/screen_yourself” but want to be able to preserve arbitrary utm tags/query strings so that campaigns to drive traffic to the more memorable “https://screen.pansift.com” can be built… otherwise the re-write drops the query strings before it hits the origin server with Google Analytics?

I know I can put analytics via CF but am already using GA on another subdomain with another UA ID on this domain with CF.

How to preserve utm query strings when the URL is rewritten?


#2

I’ve not tried this, but for your rewrite, does it include a wildcard? I ask because each wildcard (*) can be carried over as a variable ($1, $2, etc) in the rewrite.


#3

Hmm, so simple I never tried it! BRB :slight_smile:


#4

Hmmm… so… page rule now maps:

https://screen.pansift.com/* to https://sim.pansift.com/screen_yourself$1

and if I check in curl -vvv

https://screen.pansift.com/?utm_source=testing&utm_medium=hyperlink&utm_campaign=screen_yourself&utm_content=screen” mapped to “https://sim.pansift.com/screen_yourself?utm_source=testing” i.e. only 1x query string…

Google Analytics is a PITA and needs multiple query strings 3x or 4x to register on Analytics…

I also tried with the wildcard in the original request and $1$2$3$4 in the mapping/re-write but that doesn’t pass the CF validator and won’t save. If there’s 2x separated wildcard asterisks then you can use $1 $2 as per the doco. I tried quadruple * for fun too but of course it gave out :frowning:

So essentially the * wildcard only seems to grab 1x query string or token? Any more ideas or am falling foul of not RTFM’ing again? I re-read the doco but other than your link and searching in this forum, seems info on query strings is sparse?


#5

That’s something I hope someone from Cloudflare can respond to.

There’s the far outside chance it’s tied to your Cache Level settings, but I doubt it. That’s the only other setting I know of that addresses query strings:


#6

I want to redirect my URL pfans.com.ng to techmedias.xyz Please help