【发布时间】:2021-03-24 09:24:48
【问题描述】:
我在 https 上有一个 wordpress 网站,并且在没有在服务器上实施 F5 WAF 的情况下运行良好。但是一旦启用 WAF,网站就会进入无限循环。
调试后发现wordpress 301重定向到HTTPS,WAF也一样。结果,我停止了 wordpress 对 HTTPS 的 301 重定向,这解决了无限循环问题(因为 wordpress 不再进行 HTTPS 重定向)。但在这样做之后,主题/wordpress 加载的所有资产文件都被阻止,因为它们不再使用 HTTPS。
知道如何解决这个问题吗?
以下是我的 .htaccess 代码:
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteCond %{HTTP:X-Forwarded-Proto} =http
# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
PS:有什么方法可以让所有主题资源通过相对路径加载而无需基本 URL?我正在使用 Avada 主题。
【问题讨论】:
-
有什么帮助吗?
标签: php wordpress .htaccess f5 web-application-firewall