-
Notifications
You must be signed in to change notification settings - Fork 206
Expand file tree
/
Copy pathserver.php
More file actions
22 lines (13 loc) · 533 Bytes
/
server.php
File metadata and controls
22 lines (13 loc) · 533 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
// This file allows us to emulate Apache's "mod_rewrite" functionality from the built-in PHP web server.
// Provides a convenient way to test the application without having installed a "real" web server software.
// Usage:
// php -S localhost:8080 -t webroot/ server.php
$publicPath = 'webroot/';
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri = urldecode($uri);
$requested = $publicPath .$uri;
if (($uri !== '/') && file_exists($requested)) {
return false;
}
require_once $publicPath .'index.php';