Reputation: 41605
I have installed CakePHP on windows over II7 and i am having problems with the routes. I have created a Model, a Controller and a View for Users.
When i try to access the index view, i do it like this without any problem:
http://myhost/cakephp/users/
But, when I try to add a new user, the view doesn't load properly:
http://myhost/cakephp/users/add/
It shows this error:
Error: AddController could not be found.
Error: Create the class AddController below in file: app\Controller\AddController.php
In order to make it work, i have to do this in app/Config/routes.php:
Router::connect('/users/add', array('controller' => 'users', 'action' => 'add'));
But that wouldn't be necessary if it worked well. Neither the delete or view views load.
What's going on? How can i detect the problem? Thanks.
Content of routes.php:
Router::connect('/', array(
'controller' => 'pages', 'action' => 'display', 'home'
));
Router::connect('/pages/*', array(
'controller' => 'pages', 'action' => 'display'
));
CakePlugin::routes();
require CAKE . 'Config' . DS . 'routes.php';
Upvotes: 0
Views: 362
Reputation: 41605
Ok, it seems i have solved it. It was all because of adding a routing prefix using cake bake console... I had to comment this line at core.php
Configure::write('Routing.prefixes', array('users'));
Upvotes: 1