Test Site: non-index-demo.netlify.app
Demo Repository: GitHub - ClaysonIO/non-index-demo
I’m having an issue with the Netlify CLI. It doesn’t appear to respect the redirect in the Netlify.toml file. It works when deployed to Netlify, it is only an issue with the CLI.
Here’s my redirect:
[[redirects]]
from = "/app/*"
to = "/app.html"
status = 200
I can navigate to /app
without any issue. React router will also let me navigate to /app/page1
without issue. But if I attempt to refresh the page while on /app/page1
, it returns a 404.
Is there any way to resolve this issue? I’ve tried creating a _redirects file as well, without success.
I have found that adding ‘force=true’ to the redirect is a partial improvement – every other refresh of the page is successful, and the rest return a while screen.
I’m unable to reproduce this. Your website seems to be working fine. Is this resolved?
The website works fine. The issue is when running it in the Netlify CLI.
Why do you need to rename the default index.html
to app.html
? I changed that back to index.html
, removed the extra Vite config and removed both redirects. Everythig works fine. Also, the 404 is not from the CLI, it’s from Vite itself. If I keep your configuration and try using Vite server at http://localhost:5173/app/page1
, I still get a 404. I don’t think what you’re trying to achieve is supported by Vite.