rosuandreimihai
rosuandreimihai

Reputation: 656

Codeigniter 3 - subdirectory controller

I have one issue related to how to add controllers in sub directories for a better administration of large amount of files For that, I have the following structure in controllers:

controllers
--admin
----projects
--------block.php
----projects.php
----dashboard.php

If I'm heading to admin/projects the controller works just fine, but if I want to select admin/projects/block it doesn't work at all, generating a 404 page

I even tried to change the route.php using:

$route['admin/projects/block/(:any)']       = 'admin/projects/block/$1'; 

Am I doing something wrong? Do you have any idea?

Upvotes: 0

Views: 421

Answers (1)

catbadger
catbadger

Reputation: 1822

It looks like you're doing something wrong. The correct url format is: SITE_ROOT/CONTROLLER/ACTION

So when you go to admin/projects/block << it's trying to go to the block function of the projects controller.

You'll need to override routing to do what you're trying to do.

Upvotes: 1

Related Questions