我正在使用一个营销自动化平台来构建登录页面,这些登录页面的URLS会自动发布到一个子域结构中,例如:
https://subdomain.example.com/mylandingpage
我想重定向所有www和非www访问主域到这个我创建的登录页,换句话说,我希望https://example.com和https://www.example.comto被重定向到https://subdomain.example.com/mylandingpage
因为我只使用这个平台,没有订阅任何主机,所以我尝试使用Cloudflare来实现所有这些重定向。
我看了一个教程,这个家伙说我的DNS中的A条目不应该为空,并建议将它们设置为保留的IP地址,因此我将两个A条目都设置为192.0.2.0。
好的,然后我转到页面规则,设置了301重定向到*example.com,然后重定向到https://subdomain.example.com/mylandingpage
我可以看到,当我访问我的主域时,它被正确地重定向到子域,但是页面没有加载,并且我得到了一个太多重定向错误。我认为我做错了什么,它会将所有内容重定向到子域,甚至子域也会重定向到自己,甚至在主机名后有一个页面路径/mylandingpage。
我说得够清楚了吗?有没有其他方法可以做我想做的事?
发布于 2021-08-20 16:24:42
在Cloudflare页面规则中,请使用精确的域匹配,而不是*.example.com。
我们可以使用通配符的URL路径。
www.example.com/* - https://subdomain.example.com/mylandingpage example.com/* - https://subdomain.example.com/mylandingpage
https://stackoverflow.com/questions/68847766
复制相似问题