Replicate URL with router - some questions

I’ve been trying to replicate an existing URL scheme used by a website in a new Kirby-powered one. The website featured a simple blog structure (eg. The new website add dividers in the URL to clean things up. A separate page (tips-and-tricks) containing articles results in the following URL =>

As you’ve might have guessed, when a user visits the original URL, they should be redirected to the article with the seperation.

I’ve been fiddling with the router to get this to work. The problem mainly is that there are more than one separation, which makes it harder to figure.

array( 'pattern' => array('blog/stories/(:any)', 'blog/articles/(:any)', 'blog/tricks/(:any)'), 'action' => function($blog, $sub, $uid) { $page = page('blog/' . $uid); go($page ? $page->url() : 'error'); } )

Any help? Extensive documentation on the helpdesk does not really help unfortunately.

Here you go:

c::set('routes', array(
    'pattern' => 'blog/(:any)',
    'action' => function ($uid) {
      if($page = page('blog')->grandChildren()->findBy('uid', $uid)) {
        go($page, 301);
      } else {
        return site()->visit('error');


Genius. Works perfectly. Thanks a lot!