# Routes and trailing slashes

**URL:** <https://forum.getkirby.com/t/routes-and-trailing-slashes/15408>\
**Category:** Questions\
**Tags:** v3\
**Created:** [August 26, 2019, 10:45pm UTC](https://forum.getkirby.com/t/routes-and-trailing-slashes/15408 "2019-08-26T22:45:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathanhess](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@jonathanhess](https://forum.getkirby.com/u/jonathanhess)\
**Post date:** [August 26, 2019, 10:45pm UTC](https://forum.getkirby.com/t/routes-and-trailing-slashes/15408/1 "2019-08-26T22:45:10Z")

</div>

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:

```auto
 '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](https://forum.getkirby.com/t/how-to-force-trailing-slash/851) 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.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 26, 2019, 11:37pm UTC](https://forum.getkirby.com/t/routes-and-trailing-slashes/15408/2 "2019-08-26T23:37:03Z")

</div>

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.

> <https://stackoverflow.com/questions/21417263/htaccess-add-remove-trailing-slash-from-url/21417551#21417551>

---

<div class="post-metadata">

**Author:** ![jonathanhess](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@jonathanhess](https://forum.getkirby.com/u/jonathanhess)\
**Post date:** [August 28, 2019, 7:08am UTC](https://forum.getkirby.com/t/routes-and-trailing-slashes/15408/3 "2019-08-28T07:08:41Z")

</div>

Thanks @texnixe. I will try that.
