Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This is a router for Drupal and other PHP apps that rely on mod_rewrite rules for "clean URLs" so that those same apps can be run under PHP 5.4's built-in webserver which doesn't support mod_rewrite.
* @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
You can’t perform that action at this time.