Change style of urlencode


#1

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

#2

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.


#3

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.


#4

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


#5

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


#6

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.


#7

Thank you. I’ll have a look