I have the following url for a specific entity


I would like to rewrite this url to:

brands/{{ brand_title }}

How is it possible?


1 Answer 1


You don't need custom rewrites, you need a custom router. Have a look at this article:


Basically you need to check if the router is matching your controller action, and if it does, then apply the logic (brand name => brand id) and call the relevant action with the correct parameters.

  • Ok, but that is overwriting the default router with a custom one. So very risky as an error would cause site wide havock...
    – tread
    Nov 7, 2016 at 12:55
  • If at the top of the router, you check if this is a request for your controller, then you can just escape every other route. Nov 7, 2016 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.