Skip to content

Commit

Permalink
Update index.php to serve static files with query strings.
Browse files Browse the repository at this point in the history
Trim off the query string before attempting to locate the file on the
filesystem. Thanks to Marko Marković for the initial patch.

Fixes #3910
  • Loading branch information
markstory committed Jul 10, 2013
1 parent 542d594 commit 2918ae9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/webroot/index.php
Expand Up @@ -79,7 +79,8 @@

// for built-in server
if (php_sapi_name() == 'cli-server') {
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['REQUEST_URI'])) {
$uri = str_replace($_SERVER['SCRIPT_FILENAME'], WWW_ROOT, '');
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $uri)) {
return false;
}
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Console/Templates/skel/webroot/index.php
Expand Up @@ -79,7 +79,8 @@

// for built-in server
if (php_sapi_name() === 'cli-server') {
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['REQUEST_URI'])) {
$uri = str_replace($_SERVER['SCRIPT_FILENAME'], WWW_ROOT, '');
if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $uri)) {
return false;
}
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
Expand Down

0 comments on commit 2918ae9

Please sign in to comment.