urlmodel-view-controllerkohana-3kohana-3.2

How to allow hyphens in controller and action names in Kohana 3


I would like to use hyphens in my URLs, but since controllers are classes and actions are methods, they of course cannot have hyphens in them. I think for example that about-us looks a lot better in a URL than about_usor aboutus.

Is there a good and clean way to make this happen in Kohana 3.2?

Note: I've seen how you can do this with action parameters, and for that you can just make a route with regex allowing those. But I'm talking about controller and action names here.


Solution

  • You could use a lambda route or overload the Request::controller() and Request::action() methods.