docs/docs/rules/redirect.md
将匹配的请求立即重定向(302 Found)到指定URL,不请求到后台服务器。
pattern redirect://targetUrl [filters...]
| 参数 | 描述 | 详细文档 |
|---|---|---|
| pattern | 匹配请求 URL 的表达式 | 匹配模式文档 |
| targetUrl | 重定向后的 URL,可以是相对路径 | |
| filters | 可选过滤器,支持匹配: | |
| • 请求URL/方法/头部/内容 | ||
| • 响应状态码/头部 | 过滤器文档 |
www.example.com/path redirect://https://www.qq.com
www.example.com/path2 redirect://../abc/123
https://www.example.com/path/to 重定向到 https://www.qq.com(不自动拼接路径)https://www.example.com/path2/to 重定向到 https://www.example.com/abc/123# 通配符
^www.example.com/path/*** redirect://`https://www.example.com/$1`
https://www.example.com/path/to?query 重定向到 https://www.example.com/to?query301 跳转www.example.com/path/test redirect://https://www.qq.com replaceStatus://301