Organizing Your Controllers into Sub-folders in CI

Why I Copy other People’s Writings

If you are building a large application you might find it convenient to organize your controllers into sub-folders. CodeIgniter permits you to do this.

Simply create folders within your application/controllers directory and place your controller classes within them.

When using this feature the first segment of your URI must specify the folder. For example, lets say you have a controller located here:


To call the above controller your URI will look something like this:

Each of your sub-folders may contain a default controller which will be called if the URL contains only the sub-folder. Simply name your default controller as specified in your application/config/routes.php file

CodeIgniter also permits you to remap your URIs using its URI Routing feature.


About samehramzylabib

See About on
This entry was posted in CodeIgniter. Bookmark the permalink.


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s