...

View Full Version : 404 Not Found to 200 OK



Blaher
03-12-2008, 01:24 PM
I'm working on a certain template that is an error page fetching from the database based on the URI given.
The thing is, if the error page finds the page in the DB, it uses header("HTTP/1.0 200 OK"), but that was still setting my pages as a 404 error status. Then I used header("Status: HTTP/1.0 200 OK") and now it's sending a 500 error status. Is there something I have to set in my php.in or httpd.conf? Or any other remedy? I'm using hostmonster as a host currently, and my site is http://www.blahertech.org/.

If you go to /projects or something, you'll see it's coming up as a 500 error. The main page, /, doesn't because that file does exist.

-Thanks in Advanced.

Skyzyx
03-13-2008, 04:33 AM
I don't understand the question at all. Could you clarify?

Blaher
03-13-2008, 12:32 PM
There is no more simple way of clarifying, all I want is a way to make my 404 error pages 200 OK. I used header("HTTP/1.0 200 OK"), but that did nothing. Now I'm using using header("Status: HTTP/1.0 200 OK"), but that makes it a 500 internal server error.

Pennimus
03-13-2008, 12:58 PM
Puerly out of curiosity, why do you want your error page to return a 200 response?

Blaher
03-13-2008, 01:13 PM
User: Here's my post data and stuff, give me /projects please.
Server: /projects not found, but .htaccess says the 404 error document is /index.php.
Server: reading php... searching MySQL for the URI of "/projects".
Server: "/projects" found in MySQL.
Server: The Error status is now 200 OK, this page does exits.
Server: !!!!500 INTERNAL SERVER ERROR!!!!
Server: Sending content to user
User: thanks, I got the /projects page as a 500 Status
IE-Users: the /ad page is also 500, so I'm lazy and not going to display it through the object.

kbluhm
03-13-2008, 05:21 PM
header( 'HTTP/1.1 200 OK' );

Blaher
03-13-2008, 05:39 PM
The thing is, if the error page finds the page in the DB, it uses header("HTTP/1.0 200 OK"), but that was still setting my pages as a 404 error status.


header( 'HTTP/1.1 200 OK' );

EDIT: Oh I see now, I used 1.0 instead of 1.1. Thanks

edit: ok, in my code I am using 1.1, I made a mistake when I typed it. I also heard somewhere to use header("Status: HTTP/1.1 200 OK"); but that's the one giving me a 500. The other on isn't changing at all.

Blaher
03-13-2008, 06:32 PM
Ok, I used header("HTTP/1.1 300 OK") and firebug isn't showing any problems anymore. Although, I'm not sure about IE, but I'm wondering if this is a good idea?

EDIT: Ok, this doesn't fix my problem with googlebot reporting errors.

EDIT: Ok, I used 201 Created, and it works fine now. 201 fits my pages better anyways, because I'm making the page as it loads I guess.

EDIT: google doesn't like 404 pages going 2xx... :(



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum