I have a react project deployed in netlify if i navigate through my app using links i can go to that path but if i directly go to that url it says page not found hoe to deploy such apps
@Sudip-khadka What you’re seeking is referenced in the yellow warning box here in the documentation:
https://docs.netlify.com/configure-builds/javascript-spas/
Avoid 404s for SPAs
If your project is a single page app (SPA) that uses the historypushState
method to get clean URLs, you must add a rewrite rule to serve theindex.html
file no matter what URL the browser requests.
The applicable rewrite rule is outlined when following the link:
https://docs.netlify.com/routing/redirects/rewrites-proxies/#history-pushstate-and-single-page-apps
Create either a _redirects
file or netlify.toml
and apply the appropriate rule:
_redirects
/* /index.html 200
netlify.toml
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
Page not found occur to me how can i solve it ?