views:

265

answers:

2

Hi, I would like to use Zend Route to treat URI like, http:/US.video.yahoo.com and also http://video.yahoo.com with the same route. For the second proposition i would like that the system tell me that the country that was to "US" in the first one, is now at NULL.

But i don't arrive to have Zend Route Hostname doing regex like stuffs.

How could i do that ?

A: 

To achieve routing on the hostname you need Zend_Controller_Router_Route_Hostname

$hostnameRoute = new Zend_Controller_Router_Route_Hostname(
    ':country.:controller.yahoo.com',
    array( 'action' => 'index' )
);

To combine your hostname route to other routes you need Zend_Controller_Router_Route_Chain

$staticRoute = new Zend_Controller_Router_Route_Static('');

$router->addRoute('default', $hostnameRoute->chain($staticRoute);

Check out the Zend framework manual, some good examples for you to follow..

chameleon95
http://framework.zend.com/manual/en/zend.controller.router.html
chameleon95
A: 

I have already tried this. But what it produces is that when country is set to null, you have got :

http:// (dot)yahoo.com

http:// .yahoo.com

I can't arrive to do without that point !

DarKA