Fix soft 404s on nginx
curl -I https://sveleton.ramilkarimov.me/nonexistent/ returns HTTP/2 200 with the prerendered 200.html body. Same for /robots.txt and /sitemap.xml, which do not exist. Search engines treat this
as soft 404 and may index the fallback page under arbitrary URLs.
The site is fully prerendered, so there is no reason for an SPA fallback at
all. adapter-static is configured with fallback: '200.html' in vite.config.js, and the repo root also carries a placeholder 200.html with the text "Document" that nothing uses.
Tasks
- Drop
fallbackfrom the adapter config and delete the root200.html - Prerender
+error.svelteas404.htmland point nginxerror_page 404at it; usetry_files $uri $uri/index.html =404 - Add the nginx server block to the repo (or at least to the README) so the deploy is reproducible
- Verify with curl that unknown paths return 404 and robots.txt returns text/plain
Read next
