AltoRouter index.php
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 | |
header("Content-Type: text/html"); | |
include dirname(__FILE__) . '/includes/AltoRouter.php'; | |
$router = new AltoRouter(); | |
$router->setBasePath(''); | |
/* Setup the URL routing. This is production ready. */ | |
// Main routes that non-customers see | |
$router->map('GET','/', 'home.php', 'home'); | |
$router->map('GET','/home/', 'home.php', 'home-home'); | |
$router->map('GET','/plans/', 'plans.php', 'plans'); | |
$router->map('GET','/about/', 'about.php', 'about'); | |
$router->map('GET','/contact/', 'contact.php', 'contact'); | |
$router->map('GET','/tos/', 'tos.html', 'tos'); | |
// Special (payments, ajax processing, etc) | |
$router->map('GET','/charge/[*:customer_id]/','charge.php','charge'); | |
$router->map('GET','/pay/[*:status]/','payment_results.php','payment-results'); | |
// API Routes | |
$router->map('GET','/api/[*:key]/[*:name]/', 'json.php', 'api'); | |
/* Match the current request */ | |
$match = $router->match(); | |
if($match) { | |
require $match['target']; | |
} | |
else { | |
header("HTTP/1.0 404 Not Found"); | |
require '404.html'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment