Skip to content

Instantly share code, notes, and snippets.

@samsoir
Created May 28, 2010 10:46
Show Gist options
  • Select an option

  • Save samsoir/417030 to your computer and use it in GitHub Desktop.

Select an option

Save samsoir/417030 to your computer and use it in GitHub Desktop.
<?php
Route::set('feed', 'feed<format>', array('format' => '\.\w+'))
->defaults(array(
'controller' => 'feed',
));
Route::set('article', 'article(s)/<article>(<format>)', array('format' => '\.\w+'))
->defaults(array(
'format' => '.xhtml',
'controller' => 'articles',
));
Route::set('archive', 'archive(/page(/<page>))(.html)', array('page' => '\d+'))
->defaults(array(
'page' => 1,
'controller' => 'archive',
'action' => 'index',
));
// POST
Route::set('post', '<year>/<month>/<day>/<article>(.html)', array('year' => '\d{4}', 'month' => '\d{1,2}', 'day' => '\d{1,2}'))
->defaults(array(
'action' => 'item',
'controller' => 'article',
));
// AUTHENTICATION
Route::set('login', '<action>(.html)', array('action' => 'log(in|out)|register'))
->defaults(array(
'controller' => 'auth',
));
// HOME PAGE
Route::set('home', '(index.html)')
->defaults(array(
'controller' => 'index',
'action' => 'index',
));
// STATIC CONTENT
Route::set('page', '<page>.html', array('page' => '[a-zA-Z0-9_/\-]+'))
->defaults(array(
'action' => 'index',
'controller' => 'page',
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment