I currently have a CakePHP route setup from: Variable Prefixed Routing in CakePHP
Here's my routes.php:
Router::connect(
"/:forum/:controller/:action/*",
array(),
array("pass" => array("forum"))
);
Router::connect(
"/:forum",
array(
"controller" => "forums",
"action" => "index"
),
array("pass" => array("forum"))
);
This works perfectly, for example /example/users/login will be routed to UsersController::login, and $this->request->params["forum"] will contain example.
However, upon looking at tmp/logs/debug.log I see that there are a lot of errors produced by this route, and I can't understand why this happens because the routing apparently works perfectly:
2012-08-22 02:29:09 Error: [MissingControllerException] Controller class ExampleController could not be found.
#0 /var/www/app/webroot/index.php(92): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 {main}
It essentially is attempting to look for a ExampleController (because I am trying to access /example/users/login), but routes.php specifically tells CakePHP to look for Users controller as opposed to Example Controller.
Is there a way to fix this issue? I cannot understand why it happens since everything apparently works correctly.