Rewrites with Netlify

情到浓时终转凉″ 提交于 2019-12-24 16:43:00

问题


I am trying to set up some rewrites in Netlify. Here's what I have in my _redirects file:

/search xyz=:abc    https://example.com/search?xyz=:abc    200
/:abc               https://example.com/search?xyz=:abc    200

The first line works as expected, the second line is not working. However, if I change HTTP status code for the second line to 301, it works. Why is that so? I really need to rewrite like the rule in second line. Is there any other modification I can do to make it work?


回答1:


I got a response from Netlify email support.

Passing a path to a redirect as a query param is not meant to work, especially as a 200 status.

So I made some minor changes to my server and this alternative redirect rule works fine:

/:abc    https://example.com/search/:abc    200


来源:https://stackoverflow.com/questions/50048668/rewrites-with-netlify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!