子域路由规则(使用链接)在升级到 Zend Framework 1.9.5 后损坏,但仅针对根,而不是页面
我问了 几个月前关于如何以 app.ini
格式编写链接规则的类似问题。这个问题的答案非常有效!然而,现在我已经升级到最新版本的 Zend Framework 1.9.5(我需要升级以解决另一个问题),现在我的子域不再工作!
澄清一下,如果我访问 subdomain.domain.com
,它不会识别我的规则。 但是,如果我访问 subdomain.domain.com/somepage/
,它确实会识别我的路由规则。
这是我的代码:
;; the following is apparently being ignored, and does not work
routes.manager.type = "Zend_Controller_Router_Route_Hostname"
routes.manager.route = "manager.sitename.com"
routes.manager.defaults.module = "manager"
;; this is not being ignored and works!
routes.manager.chains.settings.type = "Zend_Controller_Router_Route_Static"
routes.manager.chains.settings.route = "/settings"
routes.manager.chains.settings.defaults.controller = "manager"
routes.manager.chains.settings.defaults.action = "settings"
例如,如果我转到manager.sitename.com,它只会重定向到我的默认索引和控制器(不访问模块,$this-> getRequest()->getModuleName()
为空)。 但是,如果我访问 manager.sitename.com/settings
,该页面就会出现!这个 app.ini
配置在 ZF 1.7.8 中工作正常,但现在自从我升级到 1.9.5 后,它不再工作了。
我也尝试将 routes.manager.defaults.controller = "manager"
和 routes.manager.defaults.action = 'index"
添加到我的配置中,但这并没有 。
互联网上没有太多关于处理 Zend Framework 的链接和 app.ini
信息
I asked a similar question months ago on how to write chaining rules in an app.ini
format. The answer to this question worked wonderfully! Now, however, I have upgraded to the latest version of the Zend Framework 1.9.5 (I needed to upgrade for another issue) and now my subdomains no longer work!
To clarify, if I visit subdomain.domain.com
, it does not recognize my rule.
However, if I visit subdomain.domain.com/somepage/
it does recognize my routing rule.
Here is my code:
;; the following is apparently being ignored, and does not work
routes.manager.type = "Zend_Controller_Router_Route_Hostname"
routes.manager.route = "manager.sitename.com"
routes.manager.defaults.module = "manager"
;; this is not being ignored and works!
routes.manager.chains.settings.type = "Zend_Controller_Router_Route_Static"
routes.manager.chains.settings.route = "/settings"
routes.manager.chains.settings.defaults.controller = "manager"
routes.manager.chains.settings.defaults.action = "settings"
So for example, if I go to manager.sitename.com
, it just redirects to my default index and controller (does not access the module, $this->getRequest()->getModuleName()
is blank).
However, if I go to manager.sitename.com/settings
, the page comes up! This app.ini
configuration works fine in ZF 1.7.8, But now since I upgraded to 1.9.5, it no longer works.
I have tried adding routes.manager.defaults.controller = "manager"
and routes.manager.defaults.action = 'index"
to my configuration as well, but this didn't work.
There is not much out there on the internet with chaining and app.ini
dealing with Zend Framework. Any help on this issue would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经找到了解决方案。首先,该问题是由于 Zend Framework 路由规则中的错误导致的,导致空静态路由(空白字符串)永远无法匹配。这就是为什么
sub.example.com/hello.php
可以工作,但sub.example.com
不行。有一个补丁可以解决这个问题,而且效果很好。
请前往此处了解有关此问题的更多信息并获取补丁。希望他们很快就能将此补丁集成到主干中。
I have found the solution. The problem, first off, is due to a bug in the Zend Framework routing rules, causing an empty static route (blank string) to never match. This is why
sub.example.com/hello.php
will work, but notsub.example.com
.There is a patch for this, and it works perfectly.
Please go here to read more about this issue and get the patch. Hopefully they integrate this patch into the trunk sometime soon.