From a1384f67b73eb47d2420d1668ba7bc636b2359f7 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 3 Oct 2017 01:44:06 +1300 Subject: [PATCH] Simplify serving static assets in index.php No need to perform custom file reading. See https://github.com/laravel/laravel/blob/master/server.php#L18 and http://php.net/manual/en/features.commandline.webserver.php --- index.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/index.php b/index.php index 124b7b3..e301b78 100644 --- a/index.php +++ b/index.php @@ -51,18 +51,9 @@ $_GET['url'] = $_REQUEST['url'] = $url; $fileName = dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $url; -/** - * This code is a very simple wrapper for sending files - * Very quickly pass through references to files - */ +// Pass through references to existing files if ($url && file_exists($fileName)) { - $fileURL = (dirname($_SERVER['SCRIPT_NAME']) == '/' ? '' : dirname($_SERVER['SCRIPT_NAME'])) . '/' . $url; - if (isset($_SERVER['QUERY_STRING'])) { - $fileURL .= '?' . $_SERVER['QUERY_STRING']; - } - header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently'); - header("Location: $fileURL"); - die(); + return false; } require_once 'framework/main.php';