Hi,

I have had some issues with default controllers that I have not fully
understood yet. 
So in my index.php I just do is this:

try {
    $controller->dispatch();
} catch (Exception $e) {
    // redirect to error page
    header('Location: /index/error/');
}

This way anything that is not dispatched is reirected to an error page
defined in IndexController::errorAction()
You could also try RewriteRouter to define some generic routes and set the
controller/action.
Hope this helps a bit.

Cheers,
Nick Kampilis


Mark Wright-3 wrote:
> 
> I don't understand why a default controller isn't being used. Here's my
> code:
> 
> 
> $baseUrl = substr($_SERVER['PHP_SELF'], 0,
>                  strpos($_SERVER['PHP_SELF'], '/index.php'));
> $frontController = Zend_Controller_Front::getInstance();
> $frontController->setBaseUrl($baseUrl);
> $frontController->setControllerDirectory($path_to_root .
> 'application/controllers');
> $frontController->throwExceptions(true);
> 
> $frontController->dispatch();
> 
> If I go to / or /index it works fine. If I go to /aa it throws an
> exception because aaController.php doesn't exist. But I thought the
> default controller was index so that if there is no aa controller it
> would default to the index controller. What am I missing?
> 
> 
> Mark
> 
> -- 
> Have fun or die trying - but try not to actually die.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/default-controller-issues-tf3038305s16154.html#a8471749
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to