note 61591 added to function.header
| From: | effeesse at gmail dot com | Date: | Tue, 07 Feb 2006 13:10:55 +0000 |
| Subject: | note 61591 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103196@lists.php.net to get a copy of this message | ||
I think that the location example ins't valid anymore, at least in my environment (*nix+apache,
php4.10);
It says:
header ("Location: http://".$HTTP_SERVER_VARS['HTTP_HOST'].
"/".dirname($HTTP_SERVER_VARS['PHP_SELF']).
"/".$relative_url);
but in my environment "/".dirname($HTTP_SERVER_VARS['PHP_SELF']) outputs a
double slash (//) in front fo the dirname causing php non to follow the expected redirection.
This is because $HTTP_SERVER_VARS['PHP_SELF']) adds a leading slash to the dirname.
I solved by omitting the '/' between the HTTP_HOST and the PHP_SELF.
In addiction probably is better, if not the same, to use the $_SERVER instead of the
$HTTP_SERVER_VARS.
Hope my 2 cents could be useful for someone.
----
Server IP: 213.92.11.19
Probable Submitter: 195.62.164.225 (proxied: 172.20.1.143)
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61591
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61591&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61591&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61591&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61591&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61591&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61591&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61591&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61591&report=yes
Search -- http://master.php.net/manage/user-notes.php