diff --git a/app/webroot/index.php b/app/webroot/index.php index 988343293..9e87e31d8 100644 --- a/app/webroot/index.php +++ b/app/webroot/index.php @@ -79,8 +79,7 @@ if (!defined('WWW_ROOT')) { // for built-in server if (php_sapi_name() == 'cli-server') { - $uri = str_replace($_SERVER['SCRIPT_FILENAME'], WWW_ROOT, ''); - if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $uri)) { + if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['PHP_SELF'])) { return false; } $_SERVER['PHP_SELF'] = '/' . basename(__FILE__); diff --git a/lib/Cake/Console/Templates/skel/webroot/index.php b/lib/Cake/Console/Templates/skel/webroot/index.php index 58aad8a3b..be88b567d 100644 --- a/lib/Cake/Console/Templates/skel/webroot/index.php +++ b/lib/Cake/Console/Templates/skel/webroot/index.php @@ -79,8 +79,7 @@ if (!defined('WWW_ROOT')) { // for built-in server if (php_sapi_name() === 'cli-server') { - $uri = str_replace($_SERVER['SCRIPT_FILENAME'], WWW_ROOT, ''); - if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $uri)) { + if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['PHP_SELF'])) { return false; } $_SERVER['PHP_SELF'] = '/' . basename(__FILE__);