Skip to content

Instantly share code, notes, and snippets.

@iksi
Last active October 18, 2017 07:39
Show Gist options
  • Save iksi/678171044b6a7823f9433d71a9dbe10c to your computer and use it in GitHub Desktop.
Save iksi/678171044b6a7823f9433d71a9dbe10c to your computer and use it in GitHub Desktop.
Let all other requests than file get passed to the script on duty. Use with `php -S localhost:8888 server.php`.
<?php
if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'])) return false;
$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR . 'index.php';
require_once $_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment