comparison router.php @ 85:5307abdc04c7

Updated.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 09 Mar 2015 11:54:44 +0200
parents e08f80b95910
children dcbebe8a5f97
comparison
equal deleted inserted replaced
84:7ec0ad742009 85:5307abdc04c7
1 <?php 1 <?php
2 // The hack to get this working on PHP 5.4 built-in web server 2 //
3 // php -S localhost:8888 router.php 3 // The hack to get this working on PHP 5.4 built-in web server,
4 // http://localhost:8888/ 4 // simply run the following:
5 //
6 // $ php -S localhost:8888 router.php
7 //
8 // Then head your browser to http://localhost:8888/
9 //
5 10
6 if (preg_match("/\/[a-z0-9-_]+\.(?:png|jpg|jpeg|gif|css|php)/", $_SERVER["REQUEST_URI"])) 11 if (preg_match("/\/[a-z0-9_-]+\.(?:png|jpg|jpeg|gif|css|php|js|txt|ogg|mp3|ttf)/i", $_SERVER["REQUEST_URI"]))
7 return false; 12 return false; // Serve the requested resource as-is.
8 else 13 else
9 { 14 {
10 require_once "index.php"; 15 require_once "index.php";
11 return true; 16 return true;
12 } 17 }
18 else
19 return false;
13 ?> 20 ?>