简体   繁体   English

Wordpress 403 子目录安装中的禁止错误

[英]Wordpress 403 Forbidden error in subdir installation

I installed Wordpress in a public_html subdir, let's say /wordpress/ .我在 public_html 子目录中安装了 Wordpress,比如说/wordpress/ In the public_html root / there is no index file.在 public_html 根 / 中没有索引文件。 From the wordpress admin page I set the following:从 wordpress 管理页面中,我设置了以下内容:

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

That generates the .htaccess in the public_html root directory (not in the subdir /wordpress/ ):这会在 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>

That is not correct: it does not redirect to the right subdir, so I've modified it as:这是不正确的:它不会重定向到正确的子目录,所以我将其修改为:

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

Now it seems to work: when I go to https://example.org I see the wordpress site without /wordpress/ in the links.现在它似乎起作用了:当我从 go 到https://example.org我看到 wordpress 站点在链接中没有/wordpress/时。

There is an invisible problem to the humans: if I check the https header response I get a 403 Forbidden error probably related to the lack of index file in the root dir.人类有一个看不见的问题:如果我检查 https header 响应,我得到一个403 Forbidden错误,可能与根目录中缺少索引文件有关。

That blocks the search engines spiders.这阻止了搜索引擎蜘蛛。

Any idea would be really appreciated, Thank you in advance, gil任何想法都会非常感激,提前谢谢你,吉尔

I think your case same this issue我认为您的情况与此问题相同

You can follow this methode from wordpress.您可以从 wordpress 遵循此方法

SOLVED解决了

Following @Nugie suggestion, the solution is:按照@Nugie 的建议,解决方案是:

  1. copy the index.php from /wordpress/ to public_html rootindex.php/wordpress/复制到 public_html 根目录
  2. modify the index.php in root as following:修改根目录下的 index.php 如下:

from:从:

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

to:至:

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

Now to 403 Forbidden error is gone.现在到 403 Forbidden 错误消失了。

Thank you @Nugie谢谢@Nugie

Delete .htaccess files from all folders.从所有文件夹中删除.htaccess文件。 Solved .解决了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM