Cristian Granda

Custom 404 on Vercel

Add your custom 404 error page to your app deployed on Vercel

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 🎉