这是一份quantumultX的规则。
这是因为在 iOS/iPadOS 和 macOS 的 Safari 处理重定向的机制有所不同。让我们针对 iOS/iPadOS 设备进行特别优化。
在 [rewrite_local] 中使用以下规则:
# Google 搜索重定向 (优化版)
^https?:\/\/(www\.)?google\.cn\/search\?([^&]*)&ie=UTF-8&oe=UTF-8(.*)$ url 302 https://www.google.com/search?$2&ie=UTF-8&oe=UTF-8$3
^https?:\/\/(www\.)?google\.cn\/search\?([^&]*)$ url 302 https://www.google.com/search?$2
^https?:\/\/(www\.)?(g|google)\.cn url 302 https://www.google.com
# Safari for iOS/iPadOS specific
^https?:\/\/(www\.)?google\.cn\/\?q=([^&]+) url 302 https://www.google.com/search?q=$2
^https?:\/\/(www\.)?google\.cn\/search\?client=safari(.*)$ url 302 https://www.google.com/search?client=safari$2
同时,确保在 [mitm] 部分的 hostname 中包含:
hostname = .google.cn, .g.cn, google.cn
需要注意的是,某些情况下可能需要重启设备或重新打开 QuantumultX 才能使新规则生效。