mirror of
https://github.com/silverstripe/silverstripe-installer
synced 2024-10-22 15:05:33 +00:00
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
This commit is contained in:
parent
41b87ab2d5
commit
a1384f67b7
13
index.php
13
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';
|
||||
|
Loading…
x
Reference in New Issue
Block a user