Error page previews
How to wire these into your project
Pick your framework. Each page is a standalone file — no shared config needed.
Astro
- 1. Copy
src/pages/404.astrointo your Astro project'ssrc/pages/directory. - 2. Replace the "Go home" link href with your root URL.
- 3. Astro automatically serves
404.astrofor unmatched routes on static deploys.
Next.js (App Router)
- 1. Create
app/not-found.tsx(App Router) orpages/404.tsx(Pages Router). - 2. Port the HTML structure and Tailwind classes — or just use the raw HTML from the static build.
- 3. For the 500 page, use
error.tsx(App Router).
Static hosts (Netlify / Vercel / CF Pages)
- 1. Run
npm run buildto generate the static HTML files. - 2. Copy the rendered
dist/404/index.htmlinto your host's custom error page slot. - 3. For Netlify: rename to
404.htmlat the publish root.
Offline page (Service Worker)
- 1. Pre-cache the built
offline/index.htmlin your service worker install step. - 2. On fetch failure, serve the cached offline page from the SW.
- 3. The page also exists as a static fallback if your host supports custom offline pages.