301 redirect returning 302 instead
| From: | ianevans at digitalhit dot com | Date: | Wed, 01 Nov 2006 01:17:25 +0000 |
| Subject: | 301 redirect returning 302 instead | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-243979@lists.php.net to get a copy of this message | ||
Having a problem here trying to redirect some old pages.
I've recently noticed using a server header check that my 301 redirects in
PHP are returning 302 instead.
I'm using the following code:
header('HTTP/1.1 301 Moved Permanently');
header('Location: newurl');
exit();
The header checker is returning this:
#1 Server Response: oldurl
HTTP Status Code: HTTP/1.0 302 Found
Connection: close
X-Powered-By: PHP/5.1.4
Location: newurl
Any reason why we're getting a 302 instead of a 301? This is keeping the
pages in Google instead of removing them and using the new location.
BTW, my server is lighttpd.
--
Ian Evans
Chairman & Executive Producer
DigitalHit.com