next.js - Nextjs`has`重定向在vercel中不起作用
问题描述
我正在将旧网站移至新网站,并尝试设置 301 重定向。我的旧网站 url 看起来像 /model?id=<uuid>
,新网站 url 看起来像 /model/<slug>
. 所以我设置了如下重定向。
for(var item of events) {
redirects.push({
source: `/event`,
has: [{
type: 'query',
key: 'id',
value: item.id,
}],
destination: `/events/${item.slug}`,
permanent: true,
})
}
当我在本地运行时,它运行良好。但在vercel中出现以下错误。
502: Bad Gateway
Code: TOO_MANY_FORKS
列出了大约 500 个重定向。
解决方案
推荐阅读
- bash - 如何打印出文件中出现至少 10 次的最长单词
- windows - 从包含 2 个下划线的文件名创建一个文件夹,然后将该文件放入该文件夹中
- c++ - extern "C" 静态数组函数参数
- php - 我正在做一个 preg_split 但只获得数组的第二个值的值 - PHP
- reactjs - 这个简单的反应示例有什么问题?
- sql - 用左函数过滤值而不是像“x%”
- amazon-cloudformation - 使用 CDK 动态生成 cloudformation 资源
- r - 重命名各种行
- sql - 如何获取每个客户已花费的总金额
- javascript - 写访问 Firebase 实时数据库的简单保护