Shouldn't you use...

header('HTTP/1.0 301 Moved Permanently');
header('Location: http://...');

That is what I've always used and it's worked for me. Additionally, the method you have suggested does not work for me.

-[Unknown]

-------- Original Message --------

Someone on the php-general list suggested I write here before submitting
this to bugs.php.net to see if it was a known issue.

Having a problem here trying to redirect some old pages. Running php 5.1.4
as fastcgi under lighttpd.

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("Status: 301 Moved Permanently");
header("Location: mynewurl");
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: mynewurl

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.

As per suggestions on the general list I've tried the status line before
and after the location. I've used the HTTP version instead of the
"Status:" etc.


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to