php - 安全 URL 是使用 WordPress 返回 ERR_TOO_MANY_REDIRECTS
问题描述
为什么安全 URL 使用 WordPress 返回 ERR_TOO_MANY_REDIRECTS?
- 如果我使用单个 index.php,那么 https 正在工作。
- 如果我使用 WP_HOME = https 在同一目录中添加 wordpress 项目,那么它会返回
ERR_TOO_MANY_REDIRECTS
。 - 如果我使用 WP_HOME = http 在同一目录中添加 wordpress 项目,那么它正在工作,但控制台返回
This request has been blocked; the content must be served over HTTPS using httpd
,并且无法正确显示。
htaccess 文件:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
解决方案
.htaccess
为 wordpress 子目录文件夹添加文件。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule ^(/)?$ index.php [L]
</IfModule>
推荐阅读
- html - Soup.find_all 返回一个空列表
- reactjs - Jenkins 与 S3 集成以托管 React 应用程序
- excel - 将 Gsheet 转换为 Excel 时,IFS 函数停止工作
- c - 在C中序列化函数指针并将其保存在文件中?
- openssl - 如何使用可以通过 OpenSSL 验证的 Windows 加密 API 进行签名?
- angular - 符号“ɵ”(希腊语 Theta)在 Angular 8 构建期间未转义
- mongodb - 聚合展开 Mongo 对象
- azure - 如何动态更改 Azure 数据工厂管道参数?我想从“元数据活动”为管道参数分配新值
- javascript - 带有蒙版的基本 Fabric.js 图像选择
- tsqlt - tsqlt 测试存储过程的输出参数