#19265 [Opn->Fbk]: header + relative location + cgi + aliasmatch fails
| From: | yohgaki@php.net | Date: | Sat, 07 Sep 2002 00:40:38 +0000 |
| Subject: | #19265 [Opn->Fbk]: header + relative location + cgi + aliasmatch fails | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18592@lists.php.net to get a copy of this message | ||
ID: 19265
Updated by: yohgaki@php.net
Reported By: steve@bluearena.com
-Status: Open
+Status: Feedback
Bug Type: Output Control
Operating System: Linux
PHP Version: 4CVS-2002-09-06
New Comment:
First of all, your redirect is wrong.
You must use absolute URI for Location header.
Try absolute URI, if it fixes.
Previous Comments:
------------------------------------------------------------------------
[2002-09-06 09:36:01] steve@bluearena.com
I have run into a problem with the above setup on both the latest
snapshot and also 4.2.2 - sorry if it's not a bug.
<?
if(!$test) die(header("Location: /?test=true"));
else die("redirected ok: $REQUEST_URI");
?>
This works fine, and as expected, the output is:
redirected ok: /?test=true
However if I have the following lines in my httpd.conf:
DocumentRoot /home/bla/html
AliasMatch ^/sess/(.{4})/(.*) /home/bla/html/$2
And change the script to:
<?
if(!$test) die(header("Location: /sess/1234/?test=true"));
else die("redirected ok: $REQUEST_URI");
?>
The output is:
redirected ok: /
I'm not quite sure what is going on here. I have just switched from an
Apache module to CGI version for security reasons and wasn't quite
expecting this problem so came into an interesting problem, a loop in
my program, and crashes out with an error 500:
GET / HTTP/1.0
host: www.mydomain.com
HTTP/1.1 500 Internal Server Error
Date: Fri, 06 Sep 2002 14:30:35 GMT
Server: Apache/1.3.26 (Unix) PHP/4.2.2 mod_ssl/2.8.10 OpenSSL/0.9.6g
X-Powered-By: PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3,
PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3,
PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3,
PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3
Connection: close
Content-Type: text/html; charset=iso-8859-1
Changing it to a absolute URL in the header("Location fixes the
problem but it would be a pain to change this in all my scripts. Thanks
a lot for your help.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19265&edit=1