views:

168

answers:

1

Hi,

is there any way to tell the Zend Framework Router:

  • " if www.domain.com/test " is called forward to indexController - forwardAction and recieve the parameter.
  • " if www.domain.com" is called show indexController / indexAction

??

+1  A: 

Set this function up into your bootstrap file or wherever you store your rutes:

protected function _initRouter()
{
  $this->bootstrap('frontController');
  $front = $this->getResource('frontController');
  $router = $front->getRouter();

  $router->addRoute('testToForward',
                      new Zend_Controller_Router_Route(
                          ':parameter',
                          array(
                              'controller' => 'index',
                              'action'     => 'forward',
}

Edit: This way the passed parameter will be passed as 'parameter' to the forward controller. The second route is provided by default.

erenon
sorry my failure: i mean everytime when an parameter ist provided (like test or hello) route to index/forward.
ArneRie