Routes of the Codeigniter

Asked

Viewed 1,607 times

1

I’m using Codeigniter and only the route

$route['default_controller'] = 'welcome';

is working, when I make an example:

$route['teste'] = "welcome";

he gives me the following message Cannot GET /codeigniter/index.php/test . Would anyone know what might be ? That folder containing codeigniter is inside another application

2 answers

1

The routes in codeigniter are to name paths, for example in your case the default route when opening the page index is:

$route['default_controller'] = 'welcome';

Where default_controller means it is the name for the new path and Welcome and the controller of this path, in the controller that loads the view that in the case is the visual page.

It can also be an error for you to make two calls to a controller on different routes, in which case I don’t know if it’s possible or not to use it, it’s probably possible.

in his case he is informing that he could not find the Welcome controller. Try to change "welcome"for 'welcome' and see if the Welcome controller still exists inside the application/controller folder.

For more questions maybe this link will help you:

http://codeigniterbrasil.com/configuracoes/configuracao-rotas-routes-codeigniter/

However if you do not know how to work with MVC and codeigniter will have some work to be able to do what you want.

However this site has great content about codeigniter and people who already work for a long time with this, I prefer Laravel mainly to work with routes, but I’ve used codeigniter in two previous works.

Att. Thiago Prado

  • The problem is only that it is not locating the routes, the concept and everything , I understand and I can do in other ways, I believe it is giving some error , because I am using Yeoman with php-cgi together to be able to run. I also use Laravel, but in this case, I have to use Codeigniter.

  • Without adding the new route there is still the problem? Or it only started when this new route was created?

  • Taking advantage of the way you made the test call? : http://meusite/teste or http://meusite/index.php/teste?

  • I tried to create a vhost here with a zeroed codeigniter application and it was all right. $route['default_controller'] = "welcome"; $route['404_override'] = ''; $route['teste'] = "welcome"; http://codeigniter.app/index.php/teste and the access if it happened normally without errors, probably some modification in the configs of the codeigniter caused the crash, or this missing some information in this file of routes.

0

You have already declared your default route.

 $route['default_controller'] = 'welcome';

In case you want to call the controller teste should change the standard control to $route['default_controller'] = 'teste';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.