# Use friendly URL for AgendaDetail view : possible?

**URL:** <https://forum.modmore.com/t/use-friendly-url-for-agendadetail-view-possible/2037>\
**Category:** Agenda & Cursus\
**Created:** [March 7, 2020, 12:03am UTC](https://forum.modmore.com/t/use-friendly-url-for-agendadetail-view-possible/2037 "2020-03-07T00:03:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spheerys](https://forum.modmore.com/user_avatar/forum.modmore.com/spheerys/32/158_2.png) [@Spheerys](https://forum.modmore.com/u/Spheerys)\
**Post date:** [March 7, 2020, 12:03am UTC](https://forum.modmore.com/t/use-friendly-url-for-agendadetail-view-possible/2037/1 "2020-03-07T00:03:41Z")

</div>

I didn’t found on the documentation the way to use friendly URL to view the Event Detail page, and I don’t know if it’s possible with the current version.  
In other words : instead of `www.mysupersite.com/detail?event=3` get a `www.mysupersite.com/detail/my-super-event-with-nice-keywords`

---

<div class="post-metadata">

**Author:** ![mhamstra](https://forum.modmore.com/user_avatar/forum.modmore.com/mhamstra/32/459_2.png) [@mhamstra](https://forum.modmore.com/u/mhamstra)\
**Post date:** [March 7, 2020, 12:20am UTC](https://forum.modmore.com/t/use-friendly-url-for-agendadetail-view-possible/2037/2 "2020-03-07T00:20:22Z")

</div>

I don’t know if Agenda formally supports that (Jako will surely pitch in soon! 😉 ), but typically you can do things like that using a rewrite without the extra specifically needing to support it.

You’d use something like this, which grabs the first bit of the alias before the `-` as the ID, and forwards that to the actual detail page. So you’d need a link like `www.mysupersite.com/detail/3-my-super-event-with-nice-keywords`

Put it before the standard MODX rewrite.

```auto
RewriteRule ^detail/(.*)-(.*)$ https://www.mysupersite.com/detail?event=$1

```

That rule can be optimised further, for example to only check for digits in the first group.

Probably need to generate the link yourself, there’s a useful `filterPathSegment` output filter available to turn something like a title into an alias suitable for links, so you could do something like this…

```auto
<a href="/detail/[[+id]]-[[+event_title:filterPathSegment]]">...</a>
```

---

<div class="post-metadata">

**Author:** ![jako](https://forum.modmore.com/user_avatar/forum.modmore.com/jako/32/504_2.png) [@jako](https://forum.modmore.com/u/jako)\
**Post date:** [March 7, 2020, 7:55am UTC](https://forum.modmore.com/t/use-friendly-url-for-agendadetail-view-possible/2037/3 "2020-03-07T07:55:48Z")

</div>

If you want to have a MODX internal routing, you could try the [CustomRequest](https://modx.com/extras/package/customrequest) extra. That way, the detail resource alias could be changed, without changing a htaccess rule.

Create a new CustomRequest rule, give it a name, select the detail resource in this rule and set the URI Parameter to ~~`["detail"]`~~ `["event"]`. After this you could use the following link tag in your code (the detail resource has to be a container):

`<a href="[[~<detail_id>]]/[[+id]]/[[+event_title:filterPathSegment]]">...</a>`

---

<div class="post-metadata">

**Author:** ![Spheerys](https://forum.modmore.com/user_avatar/forum.modmore.com/spheerys/32/158_2.png) [@Spheerys](https://forum.modmore.com/u/Spheerys)\
**Post date:** [March 7, 2020, 3:04pm UTC](https://forum.modmore.com/t/use-friendly-url-for-agendadetail-view-possible/2037/4 "2020-03-07T15:04:01Z")

</div>

Thanks you both for yours answers 🙂  
I’m trying to implement Jako’s solution but something is wrong.

I have set the Custom Request as you said :

 ![Screenshot_2020-03-07%20CustomRequest%20La%20Claranda](https://forum.modmore.com/uploads/default/original/1X/3145f241a246155ced075c7356a5ec54512f6ed4.png)

On my tplAgendaRow chunk I have this kind of link :

```auto
<a href="[[~19]]/[[+id]]/[[+title:filterPathSegment]]">Link</a>

```

I’m using [[+title]] instead of [[+event\_title]] because this last placeholder is not used on my side (empty value).

On the front end, I have this kind of friendly URL : [Évènement - La Claranda](https://laclaranda.eu/programmation/6/chekidjy)  
Which is looks good !

But when I follow it, the detail event are not loaded (no event found)

You can have a look on the front end here : [https://laclaranda.eu/agenda-friendlyurl](https://laclaranda.eu/agenda-friendlyurl)  
The no-friendlyURL version is here : [https://laclaranda.eu/agenda](https://laclaranda.eu/agenda)

What did I miss ?

---

<div class="post-metadata">

**Author:** ![jako](https://forum.modmore.com/user_avatar/forum.modmore.com/jako/32/504_2.png) [@jako](https://forum.modmore.com/u/jako)\
**Post date:** [March 8, 2020, 2:53pm UTC](https://forum.modmore.com/t/use-friendly-url-for-agendadetail-view-possible/2037/5 "2020-03-08T14:53:22Z")

</div>

Please use `["event"]` as URI Parameter value in CustomRequest.

---

<div class="post-metadata">

**Author:** ![Spheerys](https://forum.modmore.com/user_avatar/forum.modmore.com/spheerys/32/158_2.png) [@Spheerys](https://forum.modmore.com/u/Spheerys)\
**Post date:** [March 9, 2020, 9:38am UTC](https://forum.modmore.com/t/use-friendly-url-for-agendadetail-view-possible/2037/6 "2020-03-09T09:38:21Z")

</div>

Thanks, it’s working well now 🙂
