Renaming the url in the browser

How can I change (probably with the help of the router) the displayed address line in the browser
from https://mysite.com/productlist into https://mysite.com/tours? without swapping productlist for tours in the panel? The url ‘productlist’ should still be loaded, only the information in the address line should change. How does it works?

Sincerly Lutz

You need two routes:

'routes' => [
    [
      'pattern' => 'tours',
      'action'  => function () {
         if ( $page = page('productlist') {
           return $page->render();
         }
         $this->next();
      }
    ],
    [
      'pattern' => 'productlist',
      'action'  => function () {
        go('tours');
      }
    ]
  ]

Additionally, you can override the url() method of the productlist page in a page model. Example: Breaking content directory down by year/month to improve performance

The code snippet works fine. Thank you for the quick help.

Sincerly Lutz