|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-05-30 16:34 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 21:00:01 2025 UTC |
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.