0

我已经在我的项目中为 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/

4

1 回答 1

0

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

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

我没有对此进行测试,但它应该可以工作。

于 2012-06-27T13:47:41.367 回答