Multiple URL routes

Hi all!
I currently am removing a parent folder from the URL with:

c::set('routes', array(
  array(
    'pattern' => '(:any)',
    'action'  => function($uid) {

      $page = page($uid);

      if(!$page) $page = page('posts/' . $uid);
      if(!$page) $page = site()->errorPage();

      return site()->visit($page);

    }
  ),
  array(
    'pattern' => 'posts/(:any)',
    'action'  => function($uid) {
      go($uid);
    }
  )
));

I want add another parent folder to this route – locations/.
How would I go about adding this in?

Or, better yet, is there a way to remove all parent folders that isn’t name specific?

Cheers

2 Likes

You can pass an array of patterns: https://getkirby.com/docs/developer-guide/advanced/routing#patterns

1 Like

Page not found.