note 53825 deleted from function.header by sp
| From: | sp@php.net | Date: | Sun, 03 Jul 2005 13:57:38 +0000 |
| Subject: | note 53825 deleted from function.header by sp | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-91363@lists.php.net to get a copy of this message | ||
Note Submitter: colfer at nomail dot tld
----
Perl users beware, if you are used to printing headers to Apache, PHP will likely work differently.
I am on a typical Apache/Linux server and I found that
# php
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$url);
works the same as
# perl
print "Status: 301
Location: $url\n\n";
Both produced the proper headers
HTTP/1.1 301...
Location: ...
Connection: close...
and neither method worked in the other language. In other words:
# php: Did not work, in either order:
header("Location: ".$url);
header("Status: 301");
# php: Not needed:
header("Connection: close");
This is contrary to some of the comments below, so you may want to try both methods and check the
actual headers your server returns. The telnet method is this:
telnet domain.tld 80
GET /page.htm HTTP/1.0
(return-return)