json - 将 URL 重定向到 Ghost CMS redirects.json 中具有相同路径的另一个域
问题描述
我尝试在 ghost CMS 中使用 Redirect.json 来重定向 URL。我在redirect.json 文件中使用它
[{
"from": "/([a-zA-Z\d.-]+)",
"to": "https://blog.anotherdomain.com/$1",
"permanent": true
}]
它重定向到另一个域,但在 URL 中打印 $1 它无法获取 URL 路径请帮我解决这个问题
解决方案
解决方案
我发现你的重定向有问题!问题缺少尾随“/”和未转义的斜杠
从
/([a-zA-Z\d.-]+)
至
/([a-zA-Z\\d.-]+)/
完整复制和粘贴
[{
"from": "/([a-zA-Z\\d.-]+)/",
"to": "https://blog.anotherdomain.com/$1",
"permanent": true
}]
供未来人参考
转到/ghost/#/settings/labs
然后单击上传redirects.json
修改以下代码以匹配您的博客
[{
"from": "/([a-zA-Z\\d.-]+)/",
"to": "https://<YOUR_GOES_HERE>.com/$1",
"permanent": true
}]
有关幽灵重定向的更多信息
https://ghost.org/docs/tutorials/creating-content-collections/
推荐阅读
- docker - 并非所有响应标头都显示在 swagger UI (openapi 3.0.0) 上
- amazon-web-services - AWS EC2 深度学习实例 cuda 3.0
- random - 计算广义加法模型中的边际效应
- spring-boot - 如何在 Spring Security 中使用 Model Mapper?
- c# - URGENCE 错误 cs0542 成员名称不能与其封闭类型相同
- jquery - 什么是:数据表上的“Bfrtip”
- java - Mailgun 显示邮件实际上没有打开
- html - HTML表格修改
- python - len(list) 末尾的逗号是什么意思?
- pandas - 在数据框中,在您旋转表格后,但您想将值堆叠在另一个下方?