如何更改链接上的域但保留路径?

How to change domain on links but preserve the path?

我想通过用户脚本将 link 从 facebook.com/abcdef 重定向到 m.facebook.com/abcdef

使用:

元数据很可能也包含与您的用户脚本匹配的规则 https://m.facebook.*。因此,用户脚本在每次重定向后都会再次启动。

只需从您的规则中排除 https://m.facebook.* 或在调用 replace 方法时使用更具体的指针,例如将 'https://facebook.' 替换为 'https://m.facebook.'.