404 的 URL 不会更改,并且 WordPress 404 页面不会加载
我为 WordPress 设计了 404 页面,但是每当我尝试输入像 www.homepage.com/gobblegobble
这样的地址时,URL 保持不变,显示的页面是我的主页,即 www.homepage.com
。
理想情况下,对于此类随机链接,我希望显示 404.php 页面。我该如何改变这一点?
我的 .htaccess 文件位于 htdocs/WordPress 文件夹中,如下所示:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
#uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
ErrorDocument 404 /index.php?error=404
我通过调整永久链接解决了这个问题。很抱歉造成的麻烦。
I have designed the 404 page for WordPress however whenever I try typing out an address like www.homepage.com/gobblegobble
the URL stays the same and the page that is shown is my home page i.e. www.homepage.com
.
Ideally, for these kind of random links I want the 404.php page to be shown. How do I change that?
My .htaccess file is in the htdocs/WordPress folder and is like this:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
#uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
ErrorDocument 404 /index.php?error=404
I have solved this by tweaking the permalinks slaps forehead. Sorry for the trouble caused.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要获取当前主题目录下的
404.php
文件。 WordPress 会处理它,您无需更改.htaccess
上的任何内容。You need to take the
404.php
file under the current theme's directory. WordPress will handle it, you don't need to change anything on.htaccess
.