Can I use redirect rules to remove a query parameter from the URL?

Or in other words, strip the ?PageSpeed=noscript from any URL and 301 to the same version without the ?PageSpeed=noscript


Would go to



It shouldn’t matter was the subfolder is.

I tried some regex and “$1” but I get the below error

Any help would be appreciated

Anybody have an example where this works?

Perhaps Transform Rules are what you want.

Thank you for this but it didn’t work as this is not really re-direct…

From CF Docs

A rewrite is not visible to website visitors, since the URL displayed in the browser does not change. Configure URL Rewrite Rules to perform rewrites at the edge without reaching your web server.

Im pretty sure the regular redirect rules can do this, but I’m missing something with operators or variables.

Im able to get the below to save, but unfortunately it still won’t redirect

You’re close, but you can’t use Page Rules-style wildcards/replacements in the ruleset engine.

You probably want something like this:

That would require the Query String to just consist of PageSpeed=noscript. You could change that to contains or use http.request.uri.args for something a bit less fragile, like so:


(any(http.request.uri.args["PageSpeed"][*] == "noscript") and eq "")

URL Redirect, Type Dynamic, Expression:

concat("", http.request.uri.path)

Of course, this also has the side effect of removing every other query string from the URL.
If you were ENT, could maybe use regex replace to remove just the query string you want. Otherwise not sure.


This is where I can stuck, thank you for this.

1 Like

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