next.config.js
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'ko', 'ar'],
},
async redirects() {
return [{
source: '/ko',
destination: '/myCustomKo',
permanent: true,
locale: false,
}]
},
async rewrites() {
return {
afterFiles: [{
source: '/myCustomKo',
destination: '/ko',
}]
}
}
}
我想用我的/ko
路线去/myCustomKo
。
它仅在首先加载时才起作用。我可以看到/myCustomKo
而不是/ko
.
我用 移动路线<Link href="/">root</Link>
,我的子路径消失了。我希望它仍然/myCustomKo
不是/
。
当我尝试这个过程时/en
,一切都很完美。我点<Link />
了一下,还是这样/en
。
如何保留我的自定义子路径?
概括
当我的子路径为/en
时,我可以使用/en
.
当我的子路径是/ar
时,我也可以使用/ar
.
但是当我的子路径是时/myCustomKo
,我的路由器会错过/myCustomKo
子路径。