5.2. Using a router

To properly use the RewriteRouter you have to instantiate it, add some user defined routes and inject it into the controller. The following code illustrates the procedure:

/* -- create a router -- */

$router = new Zend_Controller_RewriteRouter();
$router->addRoute('user', 'user/:username', array('controller' => 'user', 'action' => 'info'));

/* -- set it in a controller -- */

$ctrl = Zend_Controller_Front::getInstance();
$ctrl->setRouter($router);