Redirect in netlify.toml does not work

PLEASE help us help you by writing a good post!

  • Site name: netlify.toml

  • I create a netlify.toml with the following code and it is not working:

    from = “/index.html”
    to = “/”
    status = 301
    force = false
    query = {path = “:path”}
    conditions = {Language = [“en”], Country = [“US”], Role = [“admin”]}

Not sure what is wrong. I created a _redirects file first and did not work.

Do I need to do any additional deployments for configuration files?

Thank you

Hi @aluxebox have you tried deleting your old _redirects file? I say this because Netlify will always prioritize the _redirects over netlify.toml which might be causing some collisions.

Hi there
I deleted my whole site in netlify, made sure that _redirects was deleted in github and re deployed. Still when I go to /index.html it does not redirect. Appreciate your suggestion.

Hi @aluxebox,

Thanks for reaching out!

Could you provide us with the site name or provide a url to the site that is having trouble? This will allow us to look closer into the issue.

HI there.
The site is www.aluxebox.com
I am trying to redirect from Custom Boxes For Packaging | Luxury Gift Boxes | Luxe Box to www.aluxebox.com

Thank you

You’ve directly copy-pasted the code without taking into account what it’s even doing or supposed to do. Change the above to:

[[redirects]]
  force = true
  from = "/index.html"
  status = 301
  to = "/"

With that being said, /index.html is same as /, so I’m not sure if this is supposed to work.

No need to be a snob here. If you are going to assist people just do that.