【发布时间】:2016-03-14 12:21:55
【问题描述】:
我想使用标准的服务器 404 页面,而不是通过这个 htaccess 完成的 wordpress 404 重定向页面:
# 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
但我仍然想使用永久链接。有人可以帮我修改 htaccess 文件,我可以恢复服务器的正常错误 404 吗? 谢谢
【问题讨论】:
-
其实这是不可能的。 htaccess 将所有内容重写到 index.php,因此您的网络服务器永远不会发送 404。您需要修改 wordpress。
-
可以模拟标准404错误页面...
-
@charlotte:我该怎么做?
-
在 wordpress 中查找发送 404 页面的代码,并将其替换为您想要查看的内容。
-
好吧,但它不起作用。我已经设计了错误 404 页面,但谷歌一直在访问我服务器上不存在的旧文件。我认为服务器响应阻止谷歌这样做:(
标签: php wordpress .htaccess mod-rewrite