Zend重定向器和模块作为子域

时间:2012-06-27 12:26:28

标签: zend-framework module routing subdomain

我已将项目中cms的路由配置为cms.m.dev

resources.router.routes.cms.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.cms.route = "m.dev"
resources.router.routes.cms.defaults.module = "cms"
resources.router.routes.cms.chains.admin_default.route = "/:controller/:action/*"
resources.router.routes.cms.chains.admin_default.defaults.action = "index"
resources.router.routes.cms.chains.admin_default.defaults.controller = "dashboard"

但现在我遇到了重定向器的问题:

$this->_redirector->gotoUrl('/doctor/edit/');
$this->_redirector->gotoSimple('edit', 'doctor', 'cms');

当我这样称它时,它会将我重定向到 m.dev/cms/doctor/edit 而不是 cms.m.dev/doctor/edit 。有什么办法可以告诉重定向器模块是子域,而不是子目录?

更新:我创建了路线:

resources.router.routes.cms_doctor_index.route = "/doctor/"
resources.router.routes.cms_doctor_index.type =     "Zend_Controller_Router_Route_Static"
resources.router.routes.cms_doctor_index.defaults.module = "cms"
resources.router.routes.cms_doctor_index.defaults.controller = "doctor"
resources.router.routes.cms_doctor_index.defaults.action = "index"

但它仍然将我重定向到m.dev/doctor /

1 个答案:

答案 0 :(得分:0)

您应该尝试gotoRoute()指定您希望重定向器使用您的特殊路由

gotoRoute  ( 
    array $urlOptions = array(),  
          $name = null,  // $name = "m.dev"
          $reset = false,  
          $encode = true   
 ) 

我没有对此进行过测试,但工作。