Defining route controllers in Codeigniter directories

0

I have a lot of controllers in my project, so I split the controllers into folders, site in the site folder, admin in the admin folder (within controllers ).

But I can not access the drivers without having to put the base of their folder in the URL, for example:

I want to access this way: http://localhost/gabriel/projeto/sobre
But I can only do this: http://localhost/gabriel/projeto/site/sobre

'routes' file looks like this:

$route['default_controller'] = "site/index/site";
$route['404_override'] = '';
$route['admin'] = "admin/login";

I have tried to modify htaccess but I did not get results. I put one more line in the 'routes' file:

$route['(:any)'] = "site/$1";

But by placing this line it conflicts with the Admin route and ends up receiving only one parameter in the URL.

How can I resolve this problem?

    
asked by anonymous 19.11.2014 / 05:16

1 answer

1

Try to do this, using (.*) as a catch group, getting the entire URL:

$route['admin/(.*)'] = "admin/$1";
$route['(.*)'] = "site/$1";
    
19.11.2014 / 05:38