Last active
December 21, 2015 14:02
-
-
Save kriskelly/99b322ce023779881d60 to your computer and use it in GitHub Desktop.
Routing file for running Omeka 2.x on a PHP dev server.
This file contains 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 | |
// You can run this like so: | |
// cd path/to/your/omeka/installation | |
// php -S localhost:5000 routing.php | |
// Stackoverflow: http://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php | |
function endsWith($haystack, $needle) { | |
// search forward starting from end minus needle length characters | |
return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE); | |
} | |
$uri = $_SERVER['REQUEST_URI']; | |
if (endsWith($uri, '.css') || endsWith($uri, '.js')) { | |
return false; | |
} else if (strpos($uri, '/install') === 0) { | |
include_once 'install/install.php'; | |
} else if (strpos($uri, '/admin') === 0) { | |
include_once 'admin/index.php'; | |
} else { | |
include_once 'index.php'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment