Home
Support Forums

Netlify + NextJS - 404 routes are not being redirect properly

Hi all,

**Netlify site **

What do we have?

  • NextJS → “next”: “11.1.1”
  • @netlify/plugin-nextjs”: “^4.0.0-beta.4”,

Our routes

  • pages
    • [handle]
      • [[…amount]]

What do we need?

We are having problems with NextJS dynamic URLs and Netlify, we want:

What did we try?

  • _redirects → If we use /* / 200 - all pages go netlify 404
  • _redirects → If we use /* / 400 - all pages go netlify 404
  • Change our routes to [...amount] and create a index.js inside [handle] - Internal request starts to fail and nothing works properly… but /yada-yada goes to index.js
  • custom 404 → Tried creating a 404.js inside pages but never renders our 404 always Netlify

Hi @artusi-io,

You can simply put a custom 404.html file in the root of the publish folder and Netlify will use that file without the need for any redirect rules.