简体   繁体   English

wordpress 404错误页面问题

[英]wordpress 404 error page issue

I am working on a wordpress website and the permalinks are set to default ie like http://www.example.com/?p=213 . 我正在wordpress网站上工作,并且永久链接设置为默认值,例如http://www.example.com/?p=213 If the page Id or Post Id is not valid then only it goes to the 404.php file of my theme else if I try to check 404 page for some random page like http://www.example.com/somepagename then It takes me to the host's 404 error page. 如果页面ID或Post Id无效,则仅转到我主题的404.php文件,否则,如果我尝试检查404页面中的某些随机页面(例如http://www.example.com/somepagename),则需要我进入主机的404错误页面。 How do I make this go to my theme's 404 page as well ? 如何将其转到主题的404页面? It is a trouble, I hope you guys will help me out here. 这很麻烦,希望你们能在这里帮助我。 Thank You in advance 先感谢您

About short heads up on HTTP Request Processing 关于HTTP请求处理的简短介绍

The HTTP request is processed in the following sequence HTTP请求按以下顺序处理

  1. Browser sends a request to server 浏览器向服务器发送请求
  2. Server receives the request 服务器收到请求
  3. Checks for the Page requested 检查请求的页面
    IF FOUND 如果找到
    Display Page 显示页面
    IF NOT FOUND 如果没有找到
    Display 404 Page 显示404页面

What's happening under the hood 幕后发生了什么

In case of http://www.example.com/?p=213 the page is found in the server hence the server doesn't display the 404 page. 如果是http://www.example.com/?p=213,则该页面可在服务器中找到,因此服务器不会显示404页面。 However, when wordpress processes the query string p=213 , it identifies that no such page/post exists and displays the wordpress 404 page. 但是,当wordpress处理查询字符串p = 213时 ,它标识不存在这样的页面/帖子,并显示wordpress 404页面。


In case of http://www.example.com/somepagename the page is not found in the server hence the server itself displays the 404 page even before wordpress can process it. 如果是http://www.example.com/somepagename ,则在服务器中找不到该页面,因此,即使在wordpress可以处理它之前,服务器本身也会显示404页面。

Solution

You have to make the 404 page of the wordpress (appropriate 404 for the selected theme) as the 404 page of the webserver too. 您还必须将wordpress的404页面(所选主题的相应404)作为网络服务器的404页面。 You can also link a php page to the webserver error message which would redirect to appropriate 404 pages based on themes and other factors. 您还可以将php页面链接到Web服务器错误消息,该消息将根据主题和其他因素重定向到相应的404页面。

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

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