at a quick glance it seems to me it probably turns them into
{ [key]: undefined }
It does look that way, which is why I thought the mere presence of a specified query string key would result in the rewrite rule being processed. But what I’m finding is that is not the case. If you have a rule to redirect the /path?foo, Netlify’s redirects engine doesn’t seem to pick it up. It’s like the query parameter isn’t there at all, and the engine continues processing other rules.
I haven’t actually pushed anything to production and seen how it plays out on Netlify’s servers. But using netlify dev this is what I see:
Using the _redirects file and doing something like this:
/path foo /foo.html 200
/path bar /bar.html 200
Results in:
/path?foo- rewrite rule misses and I see a 404/path?foo=- rewrite rule misses and I see a 404
But, when I use the netlify redirects playground and put in those exact same rules from the _redirects file, they get translated to this syntax for the netlify.toml file:
[[redirects]]
from = "/path"
query = {foo = ""}
to = "/foo.html"
status = 200
force = false
[[redirects]]
from = "/path"
query = {bar = ""}
to = "/bar.html"
status = 200
force = false
These rules result in:
/path?foo- rewrite rule misses and I see the 404/path?foo=- rewrite rule catches and I seefoo.html/path?bar- rewrite rule misses and I see the 404/path?bar=- rewrite rule catches and I seebar.html
Note the presence of the = sign makes the rule trigger—probably something to do with the differences in syntax between _redirects and netlify.toml.
That said, the docs for redirects in the netlify.toml file say this:
query: Query string parameters REQUIRED to match the redirect.
Note the emphasis on REQUIRED.
So perhaps there is no support for the mere presence of a query string parameter key—each query parameter HAS to have a key and a value, otherwise the redirects engine ignores it and moves on?