Show page at different url

Hi,
I am struggling with setting up a route to (hopefully) do something quite simple. I have a page at /something/page-slug, and want to have this display when someone visits /somethingelse/page-slug as well. I have been messing around with routes but can’t get this to work. This is my route currently:

[
  'pattern' => '/dashboard/(:any)',
  'action' => function($page) {
    $destination = kirby()->user()->school()->toPage()->find($page);
  }
],

But I am not sure how to actually render the page at that destination url.
Thanks for any help

You can use $page->render(): $page->render() | Kirby CMS

[
  'pattern' => '/dashboard/(:any)',
  'action' => function($page) {
    if (($p = kirby()->user()->school()->toPage()) && $destination = $p->find($page)) {
      return $destination->render();
    }
  }
],

Your route has to return the page. And never just string everything together without checking for existing objects.

And be very cautious for duplicate content with this setup. If you have to build it like this, at least set up the rel=canonical meta tag/header properly!

Thanks for the help, that has worked perfectly.

Thanks also @bvdputte for the warning - in this case it is for a dashboard with a logged-in front end user viewing their own pages, so duplication shouldn’t be an issue.