Redirect of root to file does not work

I want my site to serve a React app except on the root page, where I want to serve a simple html page. For this end I have tried to add redirects but they do not work. My api redirect and my fallback to index.html work fine, but the redirect of the root url to test.html is not picked up - the root url still serves my React app

Any idea what is happening and how I can fix it?

My site is https://priceless-nobel-df2001.netlify.app/.

The netlify.toml file has the following contents:

[[redirects]]
  from = "/api/*"
  to = "https://external-site.net/api/:splat"
  status = 200

[[redirects]]
  from = ""
  to = "/test.html"
  status = 200

[[redirects]]
  from = "/"
  to = "/test.html"
  status = 200

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

Ah, I have already found out what I can do. It appears I can use force = true to make sure it happens (as there is a document at /).
Also, I see that a trailing slash is equivalent to a url without a trailing slash so that makes it slightly simpler:

[[redirects]]
from = “/api/*”
to = “https://external-site.net/api/:splat”
status = 200

[[redirects]]
from = “/”
to = “/test.html”
status = 200
force = true

[[redirects]]
from = “/*”
to = “/index.html”
status = 200

1 Like