0

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子路径。

4

0 回答 0