Forum Moderators: coopster & phranque

Message Too Old, No Replies

404 Handler - Status Header Problem

Double status header?

         

Ulrike

11:24 am on Jan 26, 2002 (gmt 0)



I finally wrote a content creation script based on a 404 handler. The problem is still the header status response.

I included a header("HTTP/1.0: 200 OK\n") in the php script and also in the htaccess file:

Header set Status "HTTP/1.1 200 OK"
Header set Expires NOW+400000
ErrorDocument 404 /scifi/content_creator.php

Now, when I checked a url with the SimSpider tool I got a Status of 404 Not found (though the content was correctly received).

I tested the same page with the Server response tool and got:

Server Response: [mydomain.com...]
Status: HTTP/1.1 404 Not found
Server: Zeus/3.4
Date: Sat, 26 Jan 2002 11:04:27 GMT Connection: close Content-Type: text/html
Expires: Thu, 31 Jan 2002 02:11:07 GMT
Status: "HTTP/1.1 200 OK"

I'm positively clueless how SE spiders will interpret that.

I tested it with altavista's basic submit and it seemed to read it. At least it didn't note a Not Found error.
My concern is google because I get most referrals from this SE.

Can someone help me how to solve this or do I worry too much?

sugarkane

4:02 pm on Jan 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think the problem here is that PHP's header() function can only add extra headers to the server's output, not change ones already sent, and by the time the server has got to your 404 handler it's already issued a 404 header.

AFAIK the only way to really control the headers is to go for nph [webmasterworld.com] scripts.

rpking

4:55 pm on Jan 28, 2002 (gmt 0)

10+ Year Member



404 handlers work fine with PHP. Here is the header from a system I've used:

HTTP/1.1 200 OK
Date: Mon, 28 Jan 2002 16:49:34 GMT
Server: Apache/1.3.22 (Unix) PHP/4.1.1 mod_gzip/1.3.19.1a
X-Powered-By: PHP/4.1.1
Connection: close
Content-Type: text/html

The only difference I can see here is that I only use htaccess to set an ErrorDocument, not to set any headers. I would assume that this is your problem, as setting headers more than once usually causes bugs.

Ulrike

8:13 pm on Jan 29, 2002 (gmt 0)



The problem could be that I am hosted on a Zeus server and they use a particular php-modul.

littleman

9:58 pm on Jan 29, 2002 (gmt 0)



AFAIK the only way to really control the headers is to go for nph [webmasterworld.com] scripts.

Ulrike, did you catch that?
You have to rename the script to nph-whatever and plug it into your .htaccess file like this:
ErrorDocument 404 /scifi/nph-content_creator.php

You need to nph the script otherwise apache will surcomvent your script's header. Try doing a search for 'nph' here, there are some posts that will help you out.

Ulrike

11:02 am on Jan 31, 2002 (gmt 0)



I tried renaming the script nph-content_creator.php. It didn't help. Please note that I'm not hosted on an Apache server, but Zeus 3.4. They use the FastCgi/php modul.

Has anyone experiences with this combination?