fix: index
- fixed problem with files not pulling from server correct with MIME types
This commit is contained in:
@@ -3,6 +3,35 @@
|
|||||||
use App\Kernel;
|
use App\Kernel;
|
||||||
|
|
||||||
if (file_exists(__DIR__.$_SERVER['REQUEST_URI']) && is_readable(__DIR__.$_SERVER['REQUEST_URI']) && is_file(__DIR__.$_SERVER['REQUEST_URI'])) {
|
if (file_exists(__DIR__.$_SERVER['REQUEST_URI']) && is_readable(__DIR__.$_SERVER['REQUEST_URI']) && is_file(__DIR__.$_SERVER['REQUEST_URI'])) {
|
||||||
|
$header = 'text/html';
|
||||||
|
if (substr($_SERVER['REQUEST_URI'], -4) == '.css')
|
||||||
|
$header = 'text/css';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -3) == '.js')
|
||||||
|
$header = 'text/javascript';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.ico')
|
||||||
|
$header = 'image/x-icon';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.png')
|
||||||
|
$header = 'image/png';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.jpg')
|
||||||
|
$header = 'image/jpeg';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.gif')
|
||||||
|
$header = 'image/gif';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -3) == '.wo' || substr($_SERVER['REQUEST_URI'], -6) == '.woff2')
|
||||||
|
$header = 'font/woff2';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.ttf')
|
||||||
|
$header = 'font/truetype';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.eot' || substr($_SERVER['REQUEST_URI'], -5) == '.ttf-')
|
||||||
|
$header = 'application/vnd.ms-fontobject';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -4) == '.svg')
|
||||||
|
$header = 'image/svg+xml';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -5) == '.json')
|
||||||
|
$header = 'application/json';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -3) == '.otf')
|
||||||
|
$header = 'font/opentype';
|
||||||
|
elseif (substr($_SERVER['REQUEST_URI'], -5) == '.woff')
|
||||||
|
$header = 'font/woff';
|
||||||
|
|
||||||
|
print header("Content-Type: $header; charset=UTF-8");
|
||||||
print file_get_contents(__DIR__.$_SERVER['REQUEST_URI']);
|
print file_get_contents(__DIR__.$_SERVER['REQUEST_URI']);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user