ErkinDeveloper
ErkinDeveloper

Reputation: 11

Netlify: Page not found except index.html

I deployed site on Netlify, then it shows only index.html, when i clicking links which goes to other pages in my website it shows "Page not found", I used vite to run and build my project, and Tailwind for css

Upvotes: 1

Views: 395

Answers (1)

Quentin
Quentin

Reputation: 3299

If you're building an SPA, you might want all URLs to serve index.html before processing the route logic. This can be done using Netlify's File-based configuration file.

Avoid 404s
If your app uses history pushstate to get clean URLs, you must add a rewrite rule to serve the index.html file no matter what URL the browser requests.

More info on Builds configuration


netlify.toml

[build]
  command = "vite build"
  publish = "dist"

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

Upvotes: 1

Related Questions