-
-
Save sam452/812c4b79cfbe5a1cd722 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* The router.php for clean-urls when use PHP 5.4.0 built in webserver. | |
* | |
* Usage: | |
* | |
* php -S localhost:3000 .htrouter.php | |
* | |
*/ | |
$url = parse_url($_SERVER["REQUEST_URI"]); | |
if (file_exists('.' . $url['path'])) { | |
// Serve the requested resource as-is. | |
return FALSE; | |
} | |
// Remove opener slash. | |
$_GET['q'] = substr($url['path'], 1); | |
include 'index.php'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment