The most up to date way to do redirects in Next.js (2/15/2023)

Miche Wong
Feb 15, 2023

--

Hi everyone!

I wanted to drop this here to make sure anyone who is making redirects in Next.js have this information really easily.

Check it out.

In your next.config.js file:

/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
async redirects() {
return [
{
source: '/',
destination: '/index.html',
permanent: true,
},
]
},
}

module.exports = nextConfig

Love,

Miche

--

--

Miche Wong
Miche Wong

Written by Miche Wong

building the future of the internet

No responses yet