views:

138

answers:

5

I was doing some testing with some sites (that I will not mention), and they are returning 200 code when they are page not found pages. Is this against any web development standard?

This is the code that I am using to see the return code of a URL:

System.out.println(new String("getRespCode=" + urlConnection.getResponseCode() + ", HttpURLConnection=" + HttpURLConnection.HTTP_OK + "\n"));

Any ideas?

+1  A: 

Sounds like an error on their side. It may be possible too, that the 404 error was redirected to another page to display a better response, and that page is sending the 200.

John Ellinwood
+5  A: 

This is called a Soft 404 or False 404. Wikipedia has a detailled discussion. It is not allowed by any web standard (and I don't know of any argument in favor), but so is invalid HTML.

phihag
@Stephan202 No, I wanted to write "HTML", playing to the fact that completely disregarding a standard is commonplace on the web.
phihag
Thanks Phihag. Great info.
Geo
+1  A: 

It is common, though incorrect. Search engines will believe they're visiting a valid page, for example

David Caunt
A: 

Yes, it is absolutely against standards. Thats like your oil light coming on when you're running out of gas.

Unfortunately it is common; however, that does not imply that it is acceptable.

phihag left a good link, worth reading.

hmcclungiii
A: 

Note that for true 404's your code (as far as I remember) would not execute, but yield a FileNotFoundException.

Arjan