WordPress网站主页一直重定向到站点地址

问题描述 投票:0回答:1

我需要将WP网站放置在第三方CDN的后面,CDN使用专用地址加载页面,该专用地址现在基于IP,假设它是http://111.222.333.444,该站点的前端域将是https://www.example.com

我已经将WP的站点地址和Wordpress地址都配置为https://www.example.com

但是问题是打开主页将导致死循环。 CDN服务器到达http://111.222.333.444,并由WP重定向到https://www.example.com(在站点地址中配置)。

但是其他页面也像https://www.example.com/product/123一样好,因为我测试了WordPress不会在CDN到达https://111.222.333.444/product/123时自动重定向这些页面,但始终会重定向主页。

如何阻止WordPress自动将主页重定向到站点地址?我曾尝试按照此处https://wordpress.stackexchange.com/questions/71927/how-to-prevent-automatic-redirection的建议删除canonical_redirect过滤器,但没有帮助。

wordpress redirect cdn
1个回答
0
投票

结果是https://wordpress.stackexchange.com/questions/71927/how-to-prevent-automatic-redirection令人误解,应该确实是

remove_filter('template_redirect','redirect_canonical');

而不是

remove_action('template_redirect','redirect_canonical');

© www.soinside.com 2019 - 2024. All rights reserved.