【问题标题】:Wordpress 403 Forbidden error in subdir installation子目录安装中的Wordpress 403禁止错误
【发布时间】:2020-09-26 16:17:57
【问题描述】:

我在 public_html 子目录中安装了 Wordpress,比如说/wordpress/。 在 public_html 根 / 中没有索引文件。 在 wordpress 管理页面中,我设置了以下内容:

WordPress Address (URL): https://example.org/wordpress/
Site Address (URL): https://example.org/

这会在 public_html 根目录中生成.htaccess(不在子目录/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>

这是不正确的:它没有重定向到正确的子目录,所以我将其修改为:

<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>

现在它似乎工作了:当我转到 https://example.org 时,我看到链接中没有 /wordpress/ 的 wordpress 网站。

人类有一个看不见的问题:如果我检查 https 标头响应我收到 403 Forbidden 错误可能与根目录中缺少索引文件有关。

这会阻止搜索引擎蜘蛛。

任何想法都会非常感激, 先感谢您, 吉尔

【问题讨论】:

    标签: wordpress http-status-code-403


    【解决方案1】:

    我认为你的情况与issue 相同

    您可以从 wordpress 关注this methode

    【讨论】:

      【解决方案2】:

      已解决

      按照@Nugie 的建议,解决方案是:

      1. index.php/wordpress/ 复制到public_html 根目录
      2. 修改根目录下的index.php如下:

      来自:

      require __DIR__ . '/wp-blog-header.php';
      

      到:

      require __DIR__ . '/wordpress/wp-blog-header.php';
      

      现在到 403 Forbidden 错误消失了。

      谢谢@Nugie

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-10-17
        • 2016-03-26
        • 2014-09-26
        • 1970-01-01
        相关资源
        最近更新 更多