Netlify Redirects Not Applied - Fix netlify.toml / _redirects
Netlify deployed your site but the redirects/rewrites are ignored - the _redirects file is not in the publish directory, the netlify.toml rules are ordered wrong, or the SPA fallback is missing, so deep links 404.
What this error means
A deployed route returns 404 or skips an expected rewrite even though a rule exists. It is deterministic: the rule is either not shipped to the right place or shadowed by an earlier rule, so it never matches.
# Visiting /app/dashboard on a deployed SPA:
Page not found (404)
# _redirects ended up outside the publish dir, so the SPA fallback never shippedCommon causes
Rules not in the publish directory / wrong source
A _redirects file must live in the publish directory at deploy time. If it is in the repo root but the publish dir is dist, it is not shipped, so no rules apply.
Ordering or missing SPA fallback
Netlify applies the first matching rule, so a broad rule placed before a specific one shadows it. A missing /* → /index.html 200 fallback makes client-routed deep links 404.
How to fix it
Define redirects in netlify.toml with the SPA fallback last
Keep rules in netlify.toml (versioned, no path issues) and put the catch-all fallback last so specific rules win.
# netlify.toml
[[redirects]]
from = "/api/*"
to = "/.netlify/functions/api/:splat"
status = 200
[[redirects]]
from = "/*"
to = "/index.html"
status = 200Or ship _redirects into the publish dir
- Place
_redirectsso the build copies it into the publish directory (e.g.public/_redirectsfor Vite). - Order rules specific-first, catch-all last - the first match wins.
- Verify on the deployed URL (and the deploy log’s "X redirect rules processed").
How to prevent it
- Prefer
netlify.tomlredirects so rules are versioned and path-independent. - Always order specific rules before the SPA catch-all.
- Confirm the deploy log reports the expected number of redirect rules.