Hi, 
the default route in ZF is a Module Route. Try this in your bootstrap :

      $this->bootstrap('frontController');
      $front = $this->getResource('FrontController');
      $router = $front->getRouter();
      $dispatcher = $front->getDispatcher();
      $request    = $front->getRequest();

      $hostnameRoute = new Zend_Controller_Router_Route_Hostname(
        ':account.localhost',
        array(),
        array(
          'account' => '([a-z0-9]+)',
        )
      );
      $plainPathRoute = new Zend_Controller_Router_Route_Module(array(),
                                                                    $dispatcher,
                                                                    $request);
      $router->addRoute('default', $hostnameRoute->chain($plainPathRoute));
      $front->setRouter($router);


This should work, let me know.
Bye



Sergio Rinaudo



> Date: Tue, 25 Aug 2009 18:03:32 -0700
> From: [email protected]
> To: [email protected]
> Subject: [fw-general] Zend_Router Question
> 
> 
> Hello Everyone!
> 
> I've successfully setup a custom router that allows me to use sub-domains as
> account key's. For example http://foo21.example.com get's routed to
> www.example.com with an account param of foo21. However, when I add
> additional parameters to the link, the router no longer works:
> 
> http://foo21.example.com/home/index (WORKS)
> http://foo21.example.com/home/index?param1=value1 (WORKS)
> http://foo21.example.com/home/index/param1/value1 (DOES NOT WORK, router
> displays index controller and action irregardless of what's in the link)
> 
> 
> I've read the article located at
> http://www.noginn.com/2008/09/03/using-subdomains-as-account-keys/ as well
> as this mailing list for as much information as I could find on the matter.
> The following code is in my bootstrap file:
> 
> public function configureRouter()
>       {
>               $frontController = Zend_Controller_Front::getInstance();
>               $router = $frontController->getRouter();
>               $router->removeDefaultRoutes();
> 
>                 $pathRoute = new Zend_Controller_Router_Route(
>                     ':controller/:action/*',
>                      array(
>                           'controller' => 'index',
>                           'action' => 'index'
>                      )
>                  );
> 
>                  $accountRoute = new Zend_Controller_Router_Route_Hostname(
>                       ':account.localhost',
>                        NULL,
>                        array(
>                             'account' => '([a-z0-9]+)',
>                        )
>                  );
>                  $router->addRoute('default',
> $accountRoute->chain($pathRoute));
> 
>       }
> 
> What am I doing wrong here? I've been playing around with the above code for
> hours but nothing seems to work! Any help would be greatly appreciated!
> -- 
> View this message in context: 
> http://www.nabble.com/Zend_Router-Question-tp25144950p25144950.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

_________________________________________________________________
Scarica i nuovi gadget per personalizzare Messenger!
http://www.messenger.it/home_gadget.aspx

Reply via email to