views:

109

answers:

1

I asked a similar question months ago (see How do I write Routing Chains for a Subdomain in Zend Framework in a routing INI file?), 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.

A: 

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 not sub.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.

http://framework.zend.com/issues/browse/ZF-7848 Empty static route (empty string) will NEVER match (sample from docs, Route_Hostname, Route_Static)

Dan