Forum Moderators: coopster

Message Too Old, No Replies

remove header

unsetting a header possible?

         

turbohost

7:55 pm on Dec 2, 2004 (gmt 0)

10+ Year Member



Hi Guys,

Is it possble to remove a header? Let's say I've got a php script with this at the beginning :

header("HTTP/1.0 200 OK");
header("HTTP/1.1 200 OK");
header("Content-type: text/html");

This script is always loaded via an include when a page is called. There are some pages where I want to add a redirect like this

header("HTTP/1.1 301 Moved Permanently");
header("Location: [site.com...]

It would be nice (read, a LOT easier) if I could unset the 200 header and call the 301 header instead. I will have to change very complex scripts which I didn't write to get this running if a replacement is not possible.

Thx already,
Turbo

turbohost

8:18 pm on Dec 2, 2004 (gmt 0)

10+ Year Member



Somebody?

ergophobe

8:23 pm on Dec 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I believe that's a "yes":

header() [us2.php.net]:


Note: The HTTP status header line will always be the first sent to the client, regardless of the actual header() call being the first or not. The status may be overridden by calling header() with a new status line at any time unless the HTTP headers have already been sent.

Note: In PHP 3, this only works when PHP is compiled as an Apache module. You can achieve the same effect using the Status header.