zend Default controller action, before going to error

couldn't find my solution. hope you can help.

I want to have a url (like twitter) www.domain.com/USERNAME

what happen it goes to the error controller. i want it to go to a different controller in these cases. Some kind of default controller if none found.

Appreciated a small example or any info.



You should create a custom route for that:


But make sure, that you add this route first, so that following routes can match. For information about custom rotues, see the documentation of the router:


Got it to work with the following.

Placed this code in the bootstrap.

$front = $this->getResource("frontController");
$front = Zend_Controller_Front::getInstance();
 $router = $front->getRouter();

 $route = new Zend_Controller_Router_Route('/:username', array('controller' => 'index','action' => 'user'));

 $router->addRoute('minipage', $route);

An alternative for this is placing the rules in the config.ini:

routes.router.type = "Zend_Controller_Router_Route"
routes.router.route = "/:username"
routes.router.defaults.controller = "index"
routes.router.defaults.action = "minipage"

;rules for the exception to the above rulles.

routes.indexItem.type =Zend_Controller_Router_Route
routes.indexItem.route               = cms
routes.indexItem.defaults.controller    = cms
routes.indexItem.defaults.action        = index

routes.indexItem2.type =Zend_Controller_Router_Route
routes.indexItem2.route               = policy
routes.indexItem2.defaults.controller    = policy
routes.indexItem2.defaults.action        = index

routes.indexItem3.type =Zend_Controller_Router_Route
routes.indexItem3.route               = index
routes.indexItem3.defaults.controller    = index
routes.indexItem3.defaults.action        = index

And load this from the bootstrap using

$front->getRouter()-> addConfig(new Zend_Config_Ini(APPLICATION_PATH . "/configs/routes.ini"), "routes");

Need Your Help

How to bind return function to markup angular

javascript angularjs angularjs-directive ng-bind

<li ng-click="toggleTables('all')" class="active">

Opening one child form from two parents

c# winforms

okay, i'm trying to open one form from two different parents, and I can't figure out how to get it to work. I tried using a boolean for AdminStartMenu and TeacherStartMenu to make one true if open...