This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/server.php
2016-02-04 21:56:40 +01:00

16 lines
405 B
PHP

<?php
/*
* mod_rewrite emulator for php's build in server
*/
// Decode and parse the request uri
$uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
// Check if the file exist in the public directory and if it does serve it.
if ($uri !== '/' && file_exists(__DIR__ . '/public' . $uri)) {
return false;
}
// Otherwise include the router
require_once __DIR__ . '/public/index.php';