Change style of urlencode

Is ist possible to change the output of urlencode() from

http://localhost/site/category:Alpha+Beta

to lets say

http://localhost/site/category:alpha-beta

urlencode() is a native PHP method, the output cannot be changed. You could sluggify the string instead but then you will have a problem with unsluggifying your string.

Ok, i see. I will go with and try to sluggify. My goal in the long run is to get a structure wich resembles more

http://localhost/site/category/alpha-beta

but working with categories in an multilanguage environment isn’t as intuitive with kirby.

To get URLs like the above, you can use routes. You can find multiple examples here in the forum.

1 Like

Thanks @texnixe. Are there major differences regarding routing in Kirby 2 compared to Kirby 3 ?

No, you can declare them either in a plugin or in your config. The plugin syntax and the config syntax have changed, but the routes are basically the same.

Thank you. I’ll have a look