简体   繁体   English

错误网址的WordPress 404页面

[英]WordPress 404 page by wrong url

For now only if im entering page id which doesnt exist I get the 404 page. 现在只有当我输入不存在的页面ID时,我才能获得404页面。 http://EXAMPLE.COM/?page_id=51573 http://EXAMPLE.COM/?page_id=51573

But its not redirecting to 404 page if im going to http://EXAMPLE.COM/blablabla 但是,如果我要访问http://EXAMPLE.COM/blablabla,它不会重定向到404页面

is that possible to redirect those kind of addresses to 404 page in wordpress? 可以将这些地址重定向到wordpress中的404页面吗?

1- Create a 404.php page into your theme directory 1-在您的主题目录中创建一个404.php页面

2- Be sure your server allows the wordpress to manage the permalinks. 2-确保您的服务器允许wordpress管理永久链接。

3- then every page will be redirect to your customized 404.php page 3-然后每个页面将重定向到您自定义的404.php页面

More info about creating 404 error page here: http://codex.wordpress.org/Creating_an_Error_404_Page 有关创建404错误页面的更多信息,请访问: http//codex.wordpress.org/Creating_an_Error_404_Page

You'll have to create a .htaccess file and upload it to your WordPress root directory. 您必须创建一个.htaccess文件并将其上传到您的WordPress根目录。 In your .htaccess write the following: .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

In your WordPress dashboard go to Settings > Permalinks there you choose the structure you'd like. 在您的WordPress仪表板中,转到Settings > Permalinks ,您可以选择您想要的结构。 In your case this would be postname. 在你的情况下,这将是postname。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM