note 76430 deleted from function.header by nlopess

From: Date: Sun, 15 Jul 2007 10:15:49 +0000
Subject: note 76430 deleted from function.header by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-128537@lists.php.net to get a copy of this message
Note Submitter: eneville ---- A problem setting a 301 status header: header( "Location: http://www.s5h.net/", true, 301 ); was not doing this, nor in addition if I set the HTTP code using: header( "HTTP/1.1 301 Moved Permanently" ); What I eventually found was some older code I wrote which set a 404 status. So using the following combination can set a desired 301: function permanent_redirct( $l ) { header( "Location: $l", true, 301 ); header( "Status: 301 Moved Permanently", true, 301 ); exit; } I can't believe it's taken me about an hour to get to the bottom of this!

« previous php.notes (#128537) next »