Pagination broken with routing?


I’m using the following routing:

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

       $page = page($uid);

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

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

      'pattern' => 'blog/(:any)',
      'action'  => function($uid) {

Everything works fine, except the pagination. “prevPageURL()” and “nextPageURL()” return urls that are not valid. e.g. for page 2 they return “/page:2” which leads to a “Forbidden” page, when the correct url would be “/blog/page:2”.

What can I do to fix this?

Hm, the route looks alright and everything should work. Do you use a special setup, any custom configurations or some such?

Could you post your code for the pagination navigation?

Is the “Forbidden” error an Apache error page or where does that come from? Because if it’s from Apache, that means that Kirby can’t control the routing.

I think this is the same problem like

at Blogprint - a blueprint for blogs with kirby > #3

Thanks for your replies.

Indeed, it looks like it doesn’t play nice with my local MAMP install (Apache/2.2.27 (Win32)). Works fine on a freshly deployed DigitalOcean Server. So it’s not that urgent any more, now that I now it actually works in production :smile:

Yes, an Apache error page:


You don’t have permission to access /page:2 on this server.