#23911 [Opn->Bgs]: using header location with "/" as directory doesn't work properly
| From: | rasmus@php.net | Date: | Fri, 30 May 2003 21:42:42 +0000 |
| Subject: | #23911 [Opn->Bgs]: using header location with "/" as directory doesn't work properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40753@lists.php.net to get a copy of this message | ||
ID: 23911
Updated by: rasmus@php.net
Reported By: waazup at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: IIS related
Operating System: Windows XP Pro
PHP Version: 4CVS-2003-05-30 (stable)
New Comment:
This has nothing to do with PHP. Different web servers handle this
differently. According strictly to the spec (see RFC 2616 section
14.30) you have to use a full absolute URI in the location response
header. That means that using anything other than a full
http://domain/foo URL is going to give you unpredictable results.
Previous Comments:
------------------------------------------------------------------------
[2003-05-30 16:34:38] waazup at hotmail dot com
First thing is I tried this on Apache/Linux and had no problems.
I installed the CVS Windows version on my Windows XP Pro box. Today's
date is May 30th, 2003.
I create a virtual directory named "phpbugheader"
inside I've put an index.php page which just says hello world.
Then I create a subdirectory called "test" and put a script in it
called test.php
The location of the file on my box is:
http://192.168.0.3/phpbugheader/test/test.php
The contents of the file are as follows:
<?
// this works
//header("Location: http://192.168.0.3/phpbugheader/index.php");
// this doesn't work
header("Location: /phpbugheader/index.php");
die;
?>
As you will notice. If I try to redirect to the index page using the
top header call everything works fine.
If I try using the bottom header call what happens is it redirects to
the page (eg the browser displays the hello world message) the problem
is that the location still shows:
http://192.168.0.3/phpbugheader/test/test.php
This only seems to happen when the location starts with / it's seems to
work fine when using ../
This causes huge problems on site with relative images because the
browser seems to think it's in the test directory when it should be in
the base directory.
I can reproduce this bug surfing with IE6 and Mozilla1.4b and from
Mozilla1.4b on a linux client.
This leads me to conclude the bug is isolated to Windows and IIS.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23911&edit=1