Wordpress:找不到页面 - 永久链接邮寄名

Wordpress: Page not found - Permalink postname

这是一个常见问题,但在搜索了几个小时后,我找不到任何适合我的解决方案。所以,这是我的问题:

当我将永久链接设置更改为 'postname' 时,我在导航到某个页面时收到 404 错误。我使用默认设置,当我将 index.php 放在 'postname' 之前时(像这样:http://localhost/wordpress/index.php/%postname%)。但这对 SEO 来说非常丑陋和不利。

我本地的wordpress安装在这里:/var/www/html/wordpress/,所以我可以在http://localhost/wordpress/index.php

访问wordpress主页

我是 运行 Debian Jessie 和 WordPress 4.5.3

这是我的 htacces 文件,由 Wordpress (/var/www/html/wordpress/.htaccess) 自动创建。权限设置为 664.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>

# END WordPress

Apache 重写模块已启用(sudo a2enmod rewrite

试试这个:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress

编辑
在您的 /etc/apache2/apache2.conf 更改中

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>