Closed
Description
First of all, thank you for the amazing work with this package!
Currently when defining experimental rewrites in next.config.js
they are not respected in netlify and throw 404 error from netlify. Any chance they can be supported?
example of the config file:
module.exports = {
target: 'serverless',
experimental: {
redirects() {
const redirects = [
{
// Redirect root link with trailing slash to non-trailing slash, avoids 404 - See https://github.com/vercel/next.js/discussions/10651#discussioncomment-8270
source: '/:locale/',
destination: '/:locale',
permanent: process.env.NEXT_PUBLIC_APP_STAGE !== 'development', // Do not use permanent redirect locally to avoid browser caching when working on it
},
{
// Redirect link with trailing slash to non-trailing slash (any depth), avoids 404 - See https://github.com/vercel/next.js/discussions/10651#discussioncomment-8270
source: '/:locale/:path*/',
destination: '/:locale/:path*',
permanent: true
},
];
return redirects;
},
rewrites() {
const rewrites = [
{
source: '/',
destination: '/api/autoRedirectToLocalisedPage',
},
{
source: `/:locale((?!${noRedirectBasePaths.join('|')})[^/]+)(.*)`,
destination: '/api/autoRedirectToLocalisedPage',
},
];
return rewrites;
},
},
};