Initial Commit
This commit is contained in:
27
router.php
Normal file
27
router.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
|
||||
// API an index.php routen
|
||||
if (strpos($path, '/api/') === 0) {
|
||||
require __DIR__ . '/index.php';
|
||||
return true;
|
||||
}
|
||||
|
||||
// Statische Dateien ausliefern
|
||||
if ($path !== '/' && file_exists(__DIR__ . $path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Root -> public/index.html
|
||||
if ($path === '/') {
|
||||
$file = __DIR__ . '/public/index.html';
|
||||
if (file_exists($file)) {
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
readfile($file);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback an index.php
|
||||
require __DIR__ . '/index.php';
|
||||
return true;
|
||||
Reference in New Issue
Block a user