此单次重定向示例将所有对 smallshop.example.com 的请求使用 HTTPS 重定向到另一个主机名 globalstore.example.net,同时保留原始路径和查询字符串。
当传入请求匹配时
- 通配符模式
- 请求 URL:
http*://smallshop.example.com/*
- 请求 URL:
则
- 目标 URL:
https://globalstore.example.net/${2} - 状态码: 301
- 保留查询字符串: 已启用
例如,该重定向规则将执行以下重定向:
| 请求 URL | 目标 URL | 状态码 |
|---|---|---|
http://smallshop.example.com/ |
https://globalstore.example.net/ |
301 |
http://smallshop.example.com/admin/?logged_out=true |
https://globalstore.example.net/admin/?logged_out=true |
301 |
https://smallshop.example.com/?all_items=1 |
https://globalstore.example.net/?all_items=1 |
301 |
http://example.com/about/ |
(未改变) | 无 |