Reputation:
I want to remove index word from url from every action generated from index controller.
domain.com/index/user/id/1
It should be domain.com/user/id/1
and
domain.com/index/home
It should be domain.com/home
How can I do this? Please let me know if you have solution.
I am using zf1.12
Upvotes: 1
Views: 214
Reputation: 20726
You can do it in your Bootstrap.php (altough in application.ini). Add this to Bootstrap:
Bootstrap.php (untested)
/**
* Setup Routig.
* Now all calls are send to indexController like
* URL/ACTION-1
* URL/ACTION-2
*
* @return void
**/
protected function _initRouters()
{
$router = Zend_Controller_Front::getInstance()->getRouter();
$route = new Zend_Controller_Router_Route(
':action/*',
array(
'controller' => 'index',
'action' => 'index'
)
);
$router->addRoute('default', $route);
}
Application.ini (untested)
routes.index.type = "Zend_Controller_Router_Route"
routes.index.route = "/"
routes.index.defaults.module = "default"
routes.index.defaults.controller = "index"
routes.index.defaults.action = "index"
Upvotes: 1