ID:               23911
 Updated by:       [EMAIL PROTECTED]
 Reported By:      waazup at hotmail dot com
 Status:           Bogus
 Bug Type:         IIS related
 Operating System: Windows XP Pro
 PHP Version:      4CVS-2003-05-30 (stable)
 New Comment:

You are violating RFC by using relative paths in header('Location: ').
Now some webservers handle this, and some stick with RFC and don't.
This is not a bug in PHP.

You should probably use $_SERVER['HTTP_HOST'] to construct your
redirect locations which should work on all web servers.


Previous Comments:
------------------------------------------------------------------------

[2003-05-30 16:42:41] [EMAIL PROTECTED]

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. 

------------------------------------------------------------------------

[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

Reply via email to