CodeIgniter Forums
Controllers in sub-folders don't seem to work - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Controllers in sub-folders don't seem to work (/showthread.php?tid=56606)



Controllers in sub-folders don't seem to work - El Forum - 01-06-2013

[eluser]Unknown[/eluser]
edit: Nevermind, i forgot to add in index.php. i'm an idiot. :p

Hello,

I'm trying to organize all my controllers into sub-folders. As per the documentation, the first section of the url must be the folder name followed by the controller name like so

Code:
www.exampl.com/subfolder/controller/segment1/

I have done this but i'm still getting a 404 not found page.

Currently, this project sits within: localhost/project which I assume would cause the above method to break since the first segment is "project", in this case. But I modified my DocumentRoot in my hosts file so that "localhost" alone points to: localhost/project. Still getting the 404 error though.

Any one know why?

Thanks!!


Controllers in sub-folders don't seem to work - El Forum - 01-06-2013

[eluser]InsiteFX[/eluser]
You need to setup routes for them.
Code:
$route['subfolder/controller/(:any)'] = 'subfolder/controller/$1';

CodeIgniter User Guide - URI Routing