Redirect 404 errors using netlify.toml

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.

Any thoughts?

Hi @richgcook :wave:t6: ,

Can you give this support guide a read first?

Please also provide your site name/slug and confirm what steps you’ve taken to troubleshoot.

Thanks @SamO

I’ve managed to figure it out with the following…

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 404

However now I need to redirect http://www.markalexanderart.com/category/works/sand-madonnas/ (old link) to Vermilion Sands III Series (Details) → Mark Alexander Artist

[[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