Created
November 6, 2011 13:21
-
-
Save robap/1342866 to your computer and use it in GitHub Desktop.
A routing file for use with php built in web-server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Name this file .routing.php and place in webroot | |
//originally written by Ralph Schindler http://news.php.net/php.internals/53870 | |
//If using zf, this is a convenient place to define the dev environment | |
define('APPLICATION_ENV', 'development'); | |
//If the file exists or is an obvious static resource, do nothing by returning false. | |
//Route all other requests through index.php. | |
if ( preg_match('/\.(?:png|jpg|jpeg|gif|ico)$/', $_SERVER['REQUEST_URI']) || | |
file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI']) ) { | |
return false; | |
} else { | |
include_once 'index.php'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment