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.