I’m trying to set up a general redirection from anything
/ but I can’t get it to work properly.
I first tried with a
netlify.toml file in the root of my site repository:
[[redirects]] from = "/google" to = "https://www.google.com/" force = true [[redirects]] from = "/home" to = "/" force = true [[redirects]] from = "/*" to = "/" status = 301 force = true
The first two rules for
/home are added for testing purposes only, and they work, but not the last
/* one. Tried with and without status.
Then, I tried with a
_redirect file in the root of my site repository:
/* / 301
As I’m 100% sure that I’ll always want to redirect, even when the URL matches a static file, I also tried:
/* / 301!
Finally I tried to enable/disable asset optimization and Pretty URLs. None of these attempts are working. Maybe I misunderstood the
* sign in the documentation. Could someone help me?