目前只有当我进入不存在的页面id,我得到404页。http://EXAMPLE.COM/?page_id=51573
但是它不会重定向到404页,如果我去http://EXAMPLE.COM/blablabla
是可能的重定向这些地址到404页在wordpress?
你必须创建一个.htaccess
文件并将其上传到你的WordPress根目录。在你的.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
在你的WordPress仪表板去Settings > Permalinks
那里你选择你想要的结构。在您的示例中,这将是postname
1-创建一个404.php页面到您的主题目录
2-确保你的服务器允许wordpress管理永久链接。
3-然后每个页面将被重定向到您定制的404.php页面
更多关于创建404错误页面的信息:http://codex.wordpress.org/Creating_an_Error_404_Page