首页 > 解决方案 > Next.js 将 old-url 重定向到 new-url next.config 问题

问题描述

我需要为我的 Nextjs 应用重定向路线。例如,我有如下路线:

domain-name.com/keyword?=type_anything

我想用以下内容替换它:

域名.com/type_anything

我正在尝试使用next.config.js如下所示:

    async redirects() {
        return [
            {
                source: '/keyword?=:slug',
                destination: '/:slug',
                permanent: true,
            },
        ]
    },
}

标签: reactjsnext.js

解决方案


推荐阅读