+7  A: 

Here's basically what you want, in INI format:

routes.b2b.type = "Zend_Controller_Router_Route_Hostname"
routes.b2b.route = "sales.sitename.com"
; you could specify a default module (or anything) to use for the whole 
; route chain here, like so: 
; routes.b2b.defaults.module = "default"

routes.b2b.chains.signup.type = "Zend_Controller_Router_Route_Static"
routes.b2b.chains.signup.route = "/signup"
routes.b2b.chains.signup.defaults.controller = "index"
routes.b2b.chains.signup.defaults.action = "signup"

routes.b2b.chains.anotherroute.route = "/something/:foo" ; etc, etc.
routes.b2b.chains.anotherroute.defaults.action = "foo"
routes.b2b.chains.anotherroute.defaults.controller = "index"
routes.b2b.chains.anotherroute.defaults.foo = "bar"
routes.b2b.chains.anotherroute.reqs.foo = '[a-z]+'

This will give you the following routes: b2b-signup, and b2b-anotherroute.

Here's some important notes on route chaining:

When chaining routes together, the parameters of the outer route have a higher priority than the parameters of the inner route. Thus if you define a controller in the outer and in the inner route, the controller of the outer route will be selected.

Parent / child chained route names are always concatenated with a dash! So, like in the example above, b2b.chains.signup becomes a route named b2b-signup (which you can use for URL assembly, etc).

You can keep chaining! Chains of chains can have chains.

Children of chained routes do not work with wildcards. See #ZF-6654. Here's blog post that talks about why that may not be a big deal.

jason
This is exactly the answer I was looking for. You have really helped me out since I just started working with the ZF a few months back and there is literally nothing on the internet that I could find (I guess until this post) that described how to do this in the INI. Thank you very much!Can you recommend any good books for ZF?
Dan
No, sadly. I've never read any of the books (or book?) about the Zend Framework. That said, Rob Allen's Zend Framework in Action http://www.zendframeworkinaction.com/ is supposed to be good. However, due to the fast pace in which development happens with ZF, books get outdated fast; very fast. For example, nothing about route chains, Zend_Application, or Zend_Tool would be in that book.
jason
"You can keep chaining! Chains of chains can have chains."I was wondering which one is the correct way: 1. routes.b2b.chains.anotherroute.chains.yetanotherroute... 2. routes.anotherroute.chains.yetanotherroute...
Kenji Baheux
I believe your first example would be the correct one, Kenji.
jason