2015-08-19

How to use regex route rewrite in zf1

Just add construction like this to your config file:
resources.router.routes.exhange.type = "Zend_Controller_Router_Route_Regex"
resources.router.routes.exhange.route = "([a-zA-Z0-9]+)-to-([a-zA-Z0-9]+).html"
resources.router.routes.exhange.defaults.module = default
resources.router.routes.exhange.defaults.controller = index
resources.router.routes.exhange.defaults.action = exchange
resources.router.routes.exhange.map.1 = "from"
resources.router.routes.exhange.map.2 = "to"
Then you will be able to use links like: /one-to-two.html, where $_GET['from'] will be "one" and $_GET['to'] - "two".

No comments:

Post a Comment