ID: 38141
User updated by: martel at post dot pl
Reported By: martel at post dot pl
Status: Open
Bug Type: Apache2 related
Operating System: Linux Gentoo
PHP Version: 5.1.4
New Comment:
Tested it some more.
When the RewriteRule is placed under <Directory> or .htaccess it is set
correctly. When placed under <VirtualHost> it is initialized with some
bogus value.
Previous Comments:
------------------------------------------------------------------------
[2006-07-19 11:49:55] martel at post dot pl
Description:
------------
$_SERVER['SCRIPT_NAME'] is set incorrectly depending on where you place
the mod_rewrite rule. If it is placed in .htaccess, the SCRIPT_NAME is
initialized correctly but when you place the same rule in VirtualHost
in server config it is an empty string.
Not sure if it is a PHP or Apache bug but I'll start here.
The rule is:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1
Or (it's not relevant - both have the same result):
RewriteEngine On
RewriteRule !\.(js|ico|gif|jpg|png|css|swf)$ index.php
Apache2 SAPI. Apache version is 2.0.58 but I guess it may not be
relevant.
Reproduce code:
---------------
// For the URL of 'http://test.nebula.intranet/archive/2006/06'.
// File 'index.php' is located at the root of virtual host
(http://test.nebula.intranet/index.php).
var_dump($_SERVER['SCRIPT_NAME']);
Expected result:
----------------
string(10) "/index.php"
Actual result:
--------------
string(0) ""
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38141&edit=1