Skip to content

Instantly share code, notes, and snippets.

@kriskelly
Last active December 21, 2015 14:02
Show Gist options
  • Save kriskelly/99b322ce023779881d60 to your computer and use it in GitHub Desktop.
Save kriskelly/99b322ce023779881d60 to your computer and use it in GitHub Desktop.
Routing file for running Omeka 2.x on a PHP dev server.
<?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