基于这个 Nabble 线程,看起来您需要添加一个路径路由,然后将该路径路由链接到您的主机名路由。
所以也许是这样的:
; abstract routes to be used in chaining
resources.router.routes.plain.type = "Zend_Controller_Router_Route"
resources.router.routes.plain.abstract = true
resources.router.routes.plain.route = "/:controller/:action"
resources.router.routes.plain.defaults.controller = "index"
resources.router.routes.plain.defaults.action = "index"
resources.router.routes.mysite.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.mysite.abstract = true
resources.router.routes.mysite.route = "www.mysite.com"
resources.router.routes.mysite.defaults.module = "mysite"
resources.router.routes.mysite1.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.mysite1.abstract = true
resources.router.routes.mysite1.route = "www.mysite1.com"
resources.router.routes.mysite1.defaults.module = "mysite1"
; now the actual (non-abstract) routes are chains of the abstract ones
resources.router.routes.mysite-plain.type = "Zend_Controller_Router_Route_Chain"
resources.router.routes.mysite-plain.chain = "mysite,plain"
resources.router.routes.mysite1-plain.type = "Zend_Controller_Router_Route_Chain"
resources.router.routes.mysite1-plain.chain = "mysite1,plain"
实际上,我们可能可以将两个抽象的 mysiteX 路由折叠成一个抽象路由,使用一个占位符:site
来代替mysiteX
值并设置一些要求/默认值,但我认为这传达了这个想法。
未经测试 - 实际上我以前从未玩过链式路由 - 但似乎需要这样的东西才能使主机名路由工作。