Passing query string params with page rules (permanent redirect)

Hello,

I am trying to set page rule (permanent redirect) from xyz.site.com to site.com/xyz

I tried setting rule xyz.site.com/* to site.com/xyz

but query string is not passed, for example xyz.site.com/?a=b will just redirect to site.com/xyz

I tried also site.com/xyz$1 and site.com/xyz?$1 but no luck.

Thanks

You can accomplish this via wildcards and variables.

We have documentation listed here:

https://support.cloudflare.com/hc/en-us/articles/218411427-Understanding-and-configuring-Cloudflare-Page-Rules-Page-Rules-Tutorial-

It would look something like this:

xyz.site.com/* → 301/302 → https://site.com/xyz$1

You mentioned it’s not working?

Is your DNS record proxied (orange-clouded) this is required for page rules.

Example:

curl -svo /dev/null/ “Example Domain” 2>&1 | grep ‘< location’
< location: Example Domain

1 Like

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