首页 > 解决方案 > WordPress 永久链接仅适用于 URL 中的 index.php

问题描述

当我尝试更改我的 WordPress 永久链接设置时,帖子和页面的链接返回 404 页面。我发现让它们工作的唯一方法是使用普通永久链接或在我的永久链接 url 中包含 /index.php/ ,例如domain.com/index.php/postname。在没有 index.php 成为 URL 的一部分的情况下,如何让它们工作?

我的 .htaccess 在下面,我还使用了https://wordpress.org/support/article/using-permalinks/#creating-and-editing-htaccess建议的 .htaccess ,但是对永久链接的更改将代码放在下面回到htaccess文件。Mod_rewrite 在我的 Apache 服务器上启用。

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

标签: wordpresspermalinks

解决方案


推荐阅读