I have a route to rename the 'items' module to 'products', and it works in most cases, but not when there is no controller or action explicitly set in the url. For example, example.com/products
does not work, while example.com/items
does, and is the same as example.com/products/index/index
. Any ideas how to fix it, or to make controllers and actions optional?
$router->addRoute('item-alias', new Zend_Controller_Router_Route('products/:controller/:action', array(
'module'=>'items'
)));
Edit:
It seems to work when I changed it to
$router->addRoute('item-alias', new Zend_Controller_Router_Route('products/:controller/:action/*', array(
'module'=>'items'
'controller'=>'index',
'action'=>'index'
)));
The '*' allows additional optional parameters to be appended, e.g. example.com/products/index/index/page/2