How do I get rid of query strings for my url

I created a 301 redirect page rule for my url with /?* on the end to redirect all traffic to the page to the page without a query string. Most traffic gets redirected to the page, but some query strings still get through, for example: /?
For some reason, utm_source= and ref= are getting through even though I have a /?* redirect.
Most pages like /? are forwarded. Many different spammers are using ?ref= and ?utm_source= query strings on my page, and I want to get rid of those.

Please note that utm_source and other utm_* query strings are normally used by Google Analytics and other analytics software.

Perhaps a better approach than redirecting would be to rewrite the URL to pass it without the query string to Cloudflare cache and the origin.

You can do so by creating a Transform Rule for Rewriting URLs. Set it to Preserve Path, and set an empty query string.



The query string will still be visible in the browser and available to Google Analytics, but will be removed when the URL is passed down to cache/origin.

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