[英]Wordpress 403 Forbidden error in subdir installation
我在 public_html 子目录中安装了 Wordpress,比如说/wordpress/
。 在 public_html 根 / 中没有索引文件。 从 wordpress 管理页面中,我设置了以下内容:
WordPress Address (URL): https://example.org/wordpress/
Site Address (URL): https://example.org/
这会在 public_html 根目录(不在子目录/wordpress/
中)生成.htaccess
:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
这是不正确的:它不会重定向到正确的子目录,所以我将其修改为:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
现在它似乎起作用了:当我从 go 到https://example.org
我看到 wordpress 站点在链接中没有/wordpress/
时。
人类有一个看不见的问题:如果我检查 https header 响应,我得到一个403 Forbidden
错误,可能与根目录中缺少索引文件有关。
这阻止了搜索引擎蜘蛛。
任何想法都会非常感激,提前谢谢你,吉尔
解决了
按照@Nugie 的建议,解决方案是:
index.php
从/wordpress/
复制到 public_html 根目录从:
require __DIR__ . '/wp-blog-header.php';
至:
require __DIR__ . '/wordpress/wp-blog-header.php';
现在到 403 Forbidden 错误消失了。
谢谢@Nugie
从所有文件夹中删除.htaccess
文件。 解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.