Hello everyone,

I am trying to create a route within my application based upon the hostname
of the request.

Keeping this as simple as possible... I have two modules, a default module
(domain1) and another module (domain2).

http://www.domain1.com is the ZF default application module and works fine
using standard router

http://www.domain2.com is the domain I wish to route requests automatically
to the domain2 module so a request to http://www.domain2.com/news is the
equivalent of http://www.domain1.com/domain2/news.

I currently have the following set up in my Zend_Config_Ini file which is
correctly configured with the Front Controller:

routes.domain2.type = "Zend_Controller_Router_Route_Hostname"
routes.domain2.route = "www.domain2.com"
routes.domain2.chains.default.type = "Zend_Controller_Router_Route"
routes.domain2.chains.default.route = ":controller/:action/*"
routes.domain2.chains.default.defaults.module = domain2
routes.domain2.chains.default.defaults.controller = index
routes.domain2.chains.default.defaults.action = index

This currently works to a point by chaining two routes!

Everything works well except if I enter a URL such as:

http://www.domain2.com/1/2/3/4 (this URL will display the default module and
not domain2 module)

To explain this easily the following do or do not work:

http://www.domain2.com/1 => works
http://www.domain2.com/1/2 => works
http://www.domain2.com/1/2/3 => works
http://www.domain2.com/1/2/3/4 => does NOT work
http://www.domain2.com/1/2/3/4/5 => does NOT work
http://www.domain2.com/1/2/3/4/5/etc => does NOT work

The above number obviously translate to controllers and actions via the
Zend_Controller_Router_Route use of :controller followed by :action followed
by params. It just doesnt seem to work when I am using params in the above
way?!

Coincidentally http://www.domain2.com/1/2/3?param1=A&param2=B works fine.

Surely the '*' wildcard is supposed to match all params regardless? Why does
it fail when params are included?

Please help or ask me to elaborate if anything above did not make sense! Its
a simple problem but hard to explain where im at! Basically I require the
standard router functionality to be passed to the
Zend_Controller_Router_Route_Hostname route! 

Thanks,

David





-- 
View this message in context: 
http://www.nabble.com/Zend_Controller_Router_Route_Hostname-Problem---Please-help-tp24708594p24708594.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to