找不到提供 URL 的邮寄名

postname giving URL was not found

我在获取永久链接以在 debian8 上运行时遇到问题。

我的 .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

和许可 666.

但后来我将永久链接更改为 postname 而不是普通链接,我得到:

requested URL was not found on this server

在除起始页之外的所有网址上。

WordPress 使用 Apache 的 "mod_rewrite" 来提供使用永久链接的页面和帖子,听起来您的服务器上没有启用该模块。要启用它,请键入 sudo a2enmod rewrite,然后重新启动 Apache。之后,永久链接应该可以工作了。

您还可以将您更改回原来的任何文件权限。

编辑: 在您的 Apache 配置中,您可能还需要更改 AllowOverride 设置。 Ubuntu 上的默认值不允许所有 .htaccess 指令工作,因此在 Debian 上可能是相同的。您可以使用 AllowOverride All 或选择特定选项。 FileInfo 是 mod_rewrite 所需要的。 Apache 的 AllowOverride 文档 (2.4) 在这里:https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride

我使用以下命令解决了我的问题

sudo a2enmod rewrite