Forum Moderators: coopster
I have just implemented the following PHP 301 redirect on a Windows server.
<?php
// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.example.com");
exit();
?>
I checked this on one of those online server header checkers and it appears to be showing a correct 301 redirect message. I think...
HTTP Status Code: HTTP/1.1 301 OK
However, the status is slightly different to when I apply 301 redirect code to an .htaccess file on a Linux/Apache server.
HTTP Status Code: HTTP/1.1 301 Moved Permanently
What is the difference between the "301 OK" message and the "301 Moved Permanently" message? In both cases the redirect appears to work properly. I.E. the user/browser/spider is being sent to the new page.
I just want to be sure that search engines are being sent a correct 301 redirect.
Thanks for any help.
[edited by: dreamcatcher at 9:45 am (utc) on April 17, 2007]
[edit reason] Use example.com, thanks. [/edit]
6.1.1 Status Code and Reason Phrase
The Status-Code element is a 3-digit integer result code of the
attempt to understand and satisfy the request. These codes are fully
defined in section 10. The Reason-Phrase is intended to give a short
textual description of the Status-Code. The Status-Code is intended
for use by automata and the Reason-Phrase is intended for the human
user. The client is not required to examine or display the Reason-
Phrase.
Resource: RFC2616
cameraman
Just to confirm. This is what I tested out in full. Is this what you meant?
<?php
// Permanent redirection
header("HTTP/1.1 301 Moved Permanently",true,301);
header("Location: http://www.example.com");
exit();
?>