Zend_Controller_Router_Rewrite comes preconfigured with a default
route, which will match URIs in the shape of
controller/action. Additionally, a module name may be
specified as the first path element, allowing URIs of the form
module/controller/action. Finally, it will also match
any additional parameters appended to the URI by default -
controller/action/var1/value1/var2/value2.
Some examples of how such routes are matched:
<?php
// Assuming the following:
$ctrl->setControllerDirectory(
array(
'default' => '/path/to/default/controllers',
'news' => '/path/to/news/controllers',
'blog' => '/path/to/blog/controllers'
)
);
Module only:
http://example/news
module == news
Invalid module maps to controller name:
http://example/foo
controller == foo
Module + controller:
http://example/blog/archive
module == blog
controller == archive
Module + controller + action:
http://example/blog/archive/list
module == blog
controller == archive
action == list
Module + controller + action + params:
http://example/blog/archive/list/sort/alpha/date/desc
module == blog
controller == archive
action == list
sort == alpha
date == desc
The default route is simply a
Zend_Controller_Router_Route_Module object stored under
the name (index) of 'default' in RewriteRouter. It's created
more-or-less like below:
<?php
$compat = new Zend_Controller_Router_Route_Module(array(),
$dispatcher,
$request);
$this->addRoute('default', $compat);
If you do not want this particular default route in your routing
schema, you may override it by creating your own 'default' route
(i.e., storing it under the name of 'default') or removing it
altogether by using removeDefaultRoutes():
<?php
// Remove any default routes
$router->removeDefaultRoutes();




