Skip to content

Custom 404 on Vercel

vercel404
Archived article
This article is archived and is no longer updated.

Just add this to your vercel.json file to define your custom 404 page

{
  "version": 2,
  "routes": [
    { "handle": "filesystem" },
    { "src": "/(.*)", "status": 404, "dest": "/404.html" }
  ]
}

We are using this exact file for this blog that is made with Contentz, a static site generator, that already generates a /404.html file.

Now if you try to go to any other route you get that 404 error page. E.g. https://www.cristianbgp.com/asdf and it just works 馃帀