Closed alfawal closed 7 months ago
By default preact-router
runs on the client in the browser. To make vercel be aware that you're hosting an SPA they need a custom redirect to redirect all routes to index.html
. Their docs have an example on how to do that: https://vercel.com/docs/concepts/projects/project-configuration#legacy-spa-fallback
I had the same issue on Netlify, here is the doc : https://docs.netlify.com/routing/redirects/rewrites-proxies/#history-pushstate-and-single-page-apps
Create a _redirects
file in your public
folder with this content : /* /index.html 200
Marking as resolved.
I've just tried this package and it seemed fine. Then I deployed my app on Vercel. Visiting
/admin
gives me a 404 error that is handled by Vercel itself (not my<Page404 />
).app.jsx
:main.jsx
:The 404 error on Vercel when visiting![image](https://github.com/preactjs/preact-router/assets/61620817/4d04750d-0e0b-4a7c-9bfd-a60add93fc4a)
/admin
.