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.htmlerror/404.htmlnetlify.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.tomlis in the root (next toindex.html)/error/404.htmlexists 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
_redirectsfile alone (at project root) - Tested using both
netlify.tomland_redirectstogether - Removed
_redirectsto rule out conflicts - Verified
_redirectswasn’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