Display specific subpage also as directory page

Hi! I have a couple of user pages and I want to display one of the user pages (which is a example page) on the directory above. I can do this with an iframe, but I hope there is a better way. Maybe this can be done with routing but I don’t have experiences with that.

website.com/profile/user0 (example user)
website.com/profile/user1
website.com/profile/user2

website.com/profile/ -> shows content of “website.com/profile/user0” but the URL is still “website.com/profile/

Thanks!
Alex

Yes, a route would be the way to go.

c::set('routes', array(
  array(
    'pattern' => 'profile',
    'action' => function () {
      return site()->visit('profile/user0');
    }
  ),
  array(
    'pattern' => 'profile/user0',
    'action' => function () {
      go('profile');
    }
  )
));
1 Like

So great! Love Kirby!

1 Like