Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

How-To Setup Redirects For A Next.js Site On Netlify

To use a `_redirects` file, set one up in the root of your project then change your `build` line in `package.json` to:

Code

"build": "next build && cp _redirects .next/",

That puts the file in the right place at the end of the build process.

via: https://docs.netlify.com/routing/redirects/

which says: "Save a plain text file called `_redirects` without a file extension to the publish directory of your site." but doesn't tell you how to actually do it.

TODO: put in syntax

Note: saw this in the build page of netlify:

Code

A _redirects file is present in the repository but is missing in the publish directory ".next".

That was before I pushed it in with that package.json update.