The most up to date way to do redirects in Next.js (2/15/2023)
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