gregavola gregavola - 4 months ago 22
PHP Question

Default Controller in CodeIgniter

I am wondering if there is any other configuration options for a default controller.

For example - if I have a controller called "site" and I set the default controller in the following file: application/config/routes.php to:

$route['default_controller'] = "site";

I should be able to go to and that brings up the
function in the site controller.

However, if I try to do go to to load the
function I get a 404 error. If I change the URL to
it works fine - but I thought already set the default controller. Is there any way around this?

Answer Source

The only way to do it is manually writing the routing rule:

$route['index2'] = "site/index2";