Skip to content

Commit 00a6524

Browse files
committed
Fixed router.php to handle url rewrite correctly
1 parent 50b5b76 commit 00a6524

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

router.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
<?php
1+
<?php
22

33
$_SERVER['SERVER_NAME'] = 'localhost';
44

5-
return false;
5+
//http://silex.sensiolabs.org/doc/web_servers.html#php-5-4
6+
7+
$filename = $_SERVER["DOCUMENT_ROOT"] . preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
8+
if (php_sapi_name() === 'cli-server' && is_file($filename)) {
9+
return false;
10+
}
11+
12+
require $_SERVER["DOCUMENT_ROOT"] . '/index.php';

0 commit comments

Comments
 (0)