404 Header Response, but page displays ok?

2019-07-29 12:12发布

问题:

I am not the developer for the PHP site in question (and I don't PHP at all!) but I was asked to investigate this issue.

Basically, a large number of pages on one of our websites appears to return a 404 header response when using something like Live HTTP Headers (Firefox Addon) and some of our reporting tools, however, when you paste the url into the browser, the page renders fine.

I was wondering what things might cause this behaviour?

Here is an example URL which returns a 404 header response, yet renders ok:

http://www.fancyapint.com/pubs/pub1461.php

Any ideas?

  • UPDATE: Thanks for the feedback! It does sound like the developer of this site has put/left a 404 status code in that page by mistake. I will pass the information on that you've provided. Thanks again.

回答1:

404 errors are supposed to be accompanied by a document that describes the error, so it is no surprise that the page renders OK. The browser is just rendering what it expects is an HTML document explaining that the page was not found (and perhaps suggesting ways to find the content that was being sought).

This is usually caused, on a PHP website, by the header function being called and told to send a 404 status. Presumably some condition used to determine if the page was found or not is broken and now always spits out a 404.



回答2:

The problem has been narrowed down to a Word-Press update! As soon as the wp-blog-header.php include file is excluded from the page, we get an OK response.

Thanks for the help.