note 76430 added to function.header

From: Date: Sun, 15 Jul 2007 00:41:15 +0000
Subject: note 76430 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-128532@lists.php.net to get a copy of this message
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! ---- Server IP: 194.145.210.3 Probable Submitter: 81.110.242.129 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- https://master.php.net/note/edit/76430 Del: integrated -- https://master.php.net/note/delete/76430/integrated Del: useless -- https://master.php.net/note/delete/76430/useless Del: bad code -- https://master.php.net/note/delete/76430/bad+code Del: spam -- https://master.php.net/note/delete/76430/spam Del: non-english -- https://master.php.net/note/delete/76430/non-english Del: in docs -- https://master.php.net/note/delete/76430/in+docs Del: other reasons-- https://master.php.net/note/delete/76430 Reject -- https://master.php.net/note/reject/76430 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128532) next »