Re: 301 redirect returning 302 instead
| From: | ianevans at digitalhit dot com | Date: | Thu, 02 Nov 2006 21:36:35 +0000 |
| Subject: | Re: 301 redirect returning 302 instead | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-244110@lists.php.net to get a copy of this message | ||
Still scratching my head on this one...
According to what I've read, when php is run as a CGI then a Status:
number text header should be set instead. Add to that the header docs on
the php site say that "The second special case is the "Location:" header.
Not only does it send this header back to the browser, but it also returns
a REDIRECT (302) status code to the browser unless some 3xx status code
has __already been set__."
Adding those two bits together, this code SHOULD work:
header("Status: 301 Moved Permanently");
header('Location: newurl');
I've even tried using the other format:
header("Location: newurl",1,301);
No matter what, I get a 302 instead of a 301.