Hi! For some reason, I can’t get redirects to work.
I want Netlify to serve links “[site].netlify.app/doc/…” as normal and redirect everything else to the home page “[site].netlify.app/”.
I tried using this _redirects file:
/doc/* /doc/:splat 200
/* / 301!
Or this netlify.toml file:
[[redirects]]
from = “/doc/*”
to = “/doc/:splat”
status = 200
[[redirects]]
from = “/*”
to = “/”
force = true
However, they both get ignored.
- I use manual deployment, no git repo linked. I upload the website source code directly with index.html at the project’s root directory, Netlify skips building and everything else and just does post-processing, the website works as expected.
- netlify.toml or _redirects are beside index.html in Netlify’s Deploy file browser, and contain the same above rules. Filenames correct.
- Deploy summary says “2 redirect rules processed”, “All redirect rules deployed without errors”.
- Pretty URLs is off, no header rules, no functions, no edge functions. I’m on the free plan.
Any idea what could be going on?