Redirect with query parameters failing despite netlify.toml rules

Issue Summary:
Deploying a minimal test site to validate netlify.toml redirect rules based on query parameters. Intended behavior: block suspicious queries (like ?slot=777) and redirect to a custom 404 page.

Live Example:

↳ Should redirect to /error/404.html, but it just loads index.html.

Repo:
GitHub: GitHub - Kanlep/netlify-query-redirect-test: Test case for Netlify query param redirect failure
Contains:

  • index.html
  • error/404.html
  • netlify.toml (with documented redirect rules)
  • README.md (explains this test case)

netlify.toml
[[redirects]]
from = “/*”
query = { seo = “:value” }
to = “/error/404.html”
status = 404

[[redirects]]
from = “/*”
query = { apk = “:value” }
to = “/error/404.html”
status = 404

[[redirects]]
from = “/*”
query = { slot = “:value” }
to = “/error/404.html”
status = 404

Expected Behavior:
Any visit to a URL with one of those query params should redirect to /error/404.html with a 404 status.

Actual Behavior:
Netlify completely ignores the redirect and shows index.html instead.

Things We’ve Tried:

  • netlify.toml is in the root (next to index.html)
  • /error/404.html exists and is directly accessible
  • Deployed a fresh build with cache cleared
  • Changed parameter names in case of reserved word collisions
  • Tested across multiple browsers and incognito sessions
  • Tested with _redirects file alone (at project root)
  • Tested using both netlify.toml and _redirects together
  • Removed _redirects to rule out conflicts
  • Verified _redirects wasn’t ignored in .gitignore (git check-ignore -v _redirects)

Conclusion:
According to the Netlify redirect documentation, this setup should work. It doesn’t.

If this isn’t a bug, the docs may need updating. If it is a bug, please help us fix it.
If there’s something obvious I’m missing, please let me know.

Thanks in advance,
—Kanlep

Did you try using force = true?

Wow — thank you! Adding force = true fixed it instantly. I had no idea that was required for query param redirects; it wasn’t obvious to me.
Really appreciate the help — and I hope this thread helps others avoid the same confusion.

It’s not, it’s covered in here: Rewrites and proxies | Netlify Docs