Next.js 如果我通过url(浏览器地址栏)更改语言,则Nextjs-i18next返回404

Next.js 如果我通过url(浏览器地址栏)更改语言,则Nextjs-i18next返回404,next.js,i18next,react-i18next,next-i18next,Next.js,I18next,React I18next,Next I18next,我已经在我的localhost中部署了我的nextjs项目,如果我手动将浏览器url栏中的语言从“/”root(英语)和“/”de(德语)更改,那么这个工作就可以了。如果我使用切换按钮,也可以正常工作。 但当我将其作为无服务器组件部署到AWS Cloudfront中的服务器时,如果我使用切换按钮更改语言也可以正常工作,但如果我将默认语言“english”“/”(root)更改为语言“/es”,则返回“404 page not found”。 请帮帮忙?怎么了? 我的测试url如下: 谢谢 这是我

我已经在我的localhost中部署了我的nextjs项目,如果我手动将浏览器url栏中的语言从“/”root(英语)和“/”de(德语)更改,那么这个工作就可以了。如果我使用切换按钮,也可以正常工作。 但当我将其作为无服务器组件部署到AWS Cloudfront中的服务器时,如果我使用切换按钮更改语言也可以正常工作,但如果我将默认语言“english”“/”(root)更改为语言“/es”,则返回“404 page not found”。 请帮帮忙?怎么了? 我的测试url如下:

谢谢

这是我的i18n.js文件:

const NextI18Next = require('next-i18next').default
const { localeSubpaths } = require('next/config').default().publicRuntimeConfig
const path = require('path') 

module.exports = new NextI18Next({
    strictMode: false, 
    defaultLanguage: 'en',
    serverLanguageDetection: false, // <---
    otherLanguages: ['es'],
    ignoreRoutes: ['/public/', '/api/', '/auth/', '/purchase/', '/settings/'],
    localeSubpaths,
    localePath: path.resolve('./public/locales')
})
const withSass = require("@zeit/next-sass");
const { nextI18NextRewrites } = require('next-i18next/rewrites');

const localeLanguages = [
     { label: 'en', name: 'English' },
     { label: 'es', name: 'Español' }     
];
const localeSubpaths = {  
     es: 'es',
};
// Extend your Next config for advanced behavior
// See https://nextjs.org/docs/api-reference/next.config.js/introduction
let nextConfig = {
     rewrites: async () => nextI18NextRewrites(localeSubpaths),
     publicRuntimeConfig: {
          localeLanguages, 
          localeSubpaths
     },
};

// Add the Next SASS plugin
nextConfig = withSass(nextConfig);

module.exports = nextConfig;