|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-19 12:19 UTC] martel at post dot pl
[2006-07-23 12:49 UTC] sniper@php.net
[2006-08-03 12:33 UTC] martel at post dot pl
[2006-08-03 13:18 UTC] martel at post dot pl
[2006-08-05 19:38 UTC] tony2001@php.net
[2008-11-26 01:16 UTC] lbarnaud@php.net
[2008-11-26 07:56 UTC] martel at post dot pl
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 19:00:02 2025 UTC |
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) ""