Create route with Zend_Controller_Router_Route_Regex
I have one route defined in application.ini like
router.routes.xx.route = "y/:var/:controller/:action/*"
router.routes.xx.defaults.controller = "page"
router.routes.xx.defaults.action = "index"
I try to create one more route, which must take contol under urls
- Which consist of only from one word ( www.bla.pl/myname )
- This word is not eqivalent word 'excep开发者_如何学编程t' ( www.bla.pl/except -- dont process)
- transform www.bla.pl/myname into www.bla.pl/c?var=myname ( controller c with some action a and puts value 'myname' into parameter var )
I tried to write
router.routes.w.type = "Zend_Controller_Router_Route_Regex"
router.routes.w.route = "(\w)+[^?|/]"
router.routes.w.reverse = "c/var=%s"
router.routes.w.defaults.controller = "c"
router.routes.w.defaults.action = "index"
router.routes.w.map.var = 1
What do i do wrong ?
Why don't you just use a normal route ?
router.routes.w.route = "/:var"
router.routes.w.route.defaults.controller = "c"
router.routes.w.route.defaults.action = "index"
router.routes.w.reqs.var = "!(your|forbidden|words)"
This should work as expected
精彩评论