It looks like you are viewing these slides on GitHub. Please clone the source repository in order to get the included PHP examples to work.

Not enough room? My place is 2 cubic meters and we only take up 1.5 cubic meters. We've got room for a whole nother 2/3rds of a person.
http://example.org/index.php?action=zomg&page=lolhttp://example.org/zomg/lolhttp://example.org/videos/latest/hamburgershttp://example.org/search/lolcats/pictures/yes/1/200

/product/products/product/1234/products/1234/photos/product/1234/products/1234/photos/photos/product/1234/5678/products/1234/photos/5678/things/animals/dogs/beagles//movies/movies/{id}/movies/{id}/photos/actors/actors/{id}/actors/{id}/movies/about/contact
I installed shock absorbing bumpers on your ass to minimize the chance of catastrofic butt failure.
index.php
index.php in such a way so that it loads the requested content based upon the URL
mod_rewrite Apache Module
.htaccess in your root to rewrite requests to non-existing files to index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
</IfModule>
web.config in your root to redirect requests to non-existing files to index.php
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
index.php by default
index.php to force non-404 requests route to the correct file
<?php
$filename = __DIR__ . preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
if (php_sapi_name() === 'cli-server' && is_file($filename)) {
return false;
}
// rest of your code here$_SERVER['REQUEST_URI'] to get started<?php
require __DIR__ . '/vendor/autoload.php';
$router = new \Bramus\Router\Router();
$router->get('/', function() {
echo 'index';
});
$router->get('/hello', function() {
echo 'hello';
});
$router->get('/hello/(\w+)', function($name) {
echo 'hello ' . htmlentities($name);
});
$router->run();