I’m trying to set up a netlify.toml redirect for all 404 errors. I’d like all 404 to redirect to the homepage however I’m having trouble making this work.
In my netlify.toml I have the following:
[[redirects]]
from = "/*"
to = "/"
force = true
status = 404
However once deployed the changes if I visit a random URL /jdjskaizj, for example, it still shows the Netlify Page Not Found page.
[[redirects]]
from = "/category/works/sand-madonnas"
to = "/works/sand-madonnas-vermilion-sands-iii"
status = 404
[[redirects]]
from = "/*"
to = "/index.html"
status = 404
But the above doesn’t seem to work (still redirects to homepage)
I had to, after much trial and error, do the following:
[[redirects]]
from = "/category/works/sand-madonnas"
to = "/works/sand-madonnas-vermilion-sands-iii"
status = 301
force = true
[[redirects]]
from = "/*"
to = "/index.html"
status = 404