Not found routes

Edit this page

Learn how to handle server 404s and missing routes.


404s can be handled by using a +not-found.tsx route. This route matches all unmatched routes from a nested level. This is similar to [...wild].tsx. However, unlike the deep dynamic routes, +not-found.tsx is matched after API routes.

On web, the server will first serve files in the following order:

  1. Static files in the public directory.
  2. Standard and dynamic routes in the app directory.
  3. API routes in the app directory.
  4. Not found routes will be served last with a 404 status code.

On native, where there is no server, the router will first try to perform a client-navigation, then fall back on +not-found routes if no route matches.

In the future, +not-found routes will integrate with data fetching and suspense to allow for custom 404 pages during online-only native operations.