全球主机交流论坛

标题: 【不知就问 36】求一个 cloudflare 重定向 表达式 [打印本页]

作者: 不知火舞    时间: 2022-12-10 12:15
标题: 【不知就问 36】求一个 cloudflare 重定向 表达式
问题:

求一个 cf 重定向规则 带路径参数的 表达式规则。

即:cn.1.com/aaa  => hk.1.com/aaa  

静态跳转 没办法带参数,勾选 保留查询字符串  也不可以。

动态跳转需要表达式,求大佬分享下。

-----------


需求描述:

cn.1.com 国内访问时  cf - 源站

cn.1.com 国外访问时  跳转到 hk.1.com  并带上路径参数


页面规则可以实现全部  301

cn.1.com 跳转到 hk.1.com

但是页面规则无法分区域  分线路解析也不好用 因为都套在 cf 下




谢谢大佬






作者: 不知火舞    时间: 2022-12-10 12:41
up
作者: xayle    时间: 2022-12-10 12:57
(ip.geoip.country ne "CN" and http.host eq "cn.1.com")

concat("https://hk1.example.com", http.request.uri.path)
动态 试试
作者: 不知火舞    时间: 2022-12-12 09:39
xayle 发表于 2022-12-10 12:57
(ip.geoip.country ne "CN" and http.host eq "cn.1.com")

concat("https://hk1.example.com", http.reque ...

感谢大佬

已经成功了



谢谢大佬




欢迎光临 全球主机交流论坛 (https://91ai.net/) Powered by Discuz! X3.4