我已经对这个问题非常关注,但没有一个解决方案可以帮助我。我在我的 Apache 上安装了一个新的 Wordpress。将永久链接结构从默认 (www.domain.com/?p=id) 更改为另一个后,wordpress 为除主页之外的每个页面都提供了 404 错误。
我已经检查了以下内容:
- mod_rewrite 已安装并启用(通过 phpinfo 检查)
- .htaccess 是可读写的
这是我的默认 .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
使用插件“调试这个”,我还可以发现,重写规则总是提供额外的 index.php?一开始。例如。 sitemap_index\.xml$
被重写为 index.php?sitemap=1
我能做些什么来解决这个问题?像 www.domain.com/?p=1 这样的默认链接,但这会扼杀我所有的 SEO。
编辑:安装后,自定义永久链接中也写了/index.php/%postname%
。但此设置也返回 404。
最佳答案
打开这个文件
/etc/apache2/apache2.conf
将所有 AllowOverride None 更改为 AllowOverride All 并重新启动您的 apache 之后更新您的永久链接结构以发布和更新它。
路径可以不同于“/etc/apache2/apache2.conf”
关于Wordpress 帖子页面获得 404 但主页有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47307662/