Routes and trailing slashes

Hi,
I have a simple website with events. All of them are shown on the home site. Now I created a route from the docs to redirect an event to the home site and adding the url as hash:

 'routes' => [
    [
      'pattern' => 'events/(:any)',
      'action'  => function ($hash) {
        return go('#' . $hash);
       }
    ],
  ]

The route works, but it adds a trailing slash and now the anchorlink doesn’t work. My url looks now like this: www.mysite.test/#myevent/. If I remove the trailing slash it works as expected.
Also if I create links to other pages it adds the trailing slash: www.mysite.test/anothersite/

I found a hint for Kirby 2 to update the .htacces file, but it didn’t seem to work in Kirby 3 or in my case.

Could this be a php problem? I’m on php 7.3 and tried it with the latest starterkit.

That doesn’t seem to be a problem with the route if you get those trailing slashes for other pages as well. The .htaccess would be a place to fix this, yes.

Thanks @texnixe. I will try that.