0

I'm new guys on Zend Framework I have a problem with router and modular on Zend I have a router.ini to route with friendly URL rewrite:

routers.prod-cat-details.type           = Zend_Controller_Router_Route_Regex
routers.prod-cat-details.route          = "([a-zA-Z0-9\-]+)/*([a-zA-Z0-9\-]+)/*([a-zA-Z0-9\-]+)\.html"
routers.prod-cat-details.defaults.module         = "default"
routers.prod-cat-details.defaults.controller    = "products"
routers.prod-cat-details.defaults.action         = "detail"
routers.prod-cat-details.map.1          = "uri_cat_level0"
routers.prod-cat-details.map.2          = "uri_cat"
routers.prod-cat-details.map.3          = "uri"


routers.prod-cat-parent.type            = Zend_Controller_Router_Route_Regex
routers.prod-cat-parent.route           = "([a-zA-Z0-9\-]+)/*([a-zA-Z0-9\-]+)"
routers.prod-cat-parent.defaults.module         = "default"
routers.prod-cat-parent.defaults.controller     = "products"
routers.prod-cat-parent.defaults.action         = "category"
routers.prod-cat-parent.map.1           = "uri_cat_level0"
routers.prod-cat-parent.map.2           = "uri_cat"


routers.prod-cat.type           = Zend_Controller_Router_Route_Regex
routers.prod-cat.route          = "([a-zA-Z0-9\-]+)"
routers.prod-cat.defaults.module        = "default"
routers.prod-cat.defaults.controller    = "products"
routers.prod-cat.defaults.action        = "category"
routers.prod-cat.map.1          = "uri_cat"

My code is divided into modules when I don't using router (dont't setup router on Boottrap), I can use module zend (exp: localhost/admin -> go to admin module) but when I active the route -> localhost/admin -> go to "products" controller "category" action

Plz help me resolve this problem. thanks in advance (sorry for my bad English :D)

1 Answers1

0

Your issue is that your "prod-cat" route will match requests to /admin, since the regular expression pattern you've provided will match any string. You'll need to either put some restrictions on that route to narrow what it matches, or put in some static routes below that to match certain pages like /admin that you want to go to other controllers.

See the answer I put on this question: Zend Routing problems for a little more background on how routing works in ZF which should explain things.

Community
  • 1
  • 1
Tim Fountain
  • 33,093
  • 5
  • 41
  • 69