Tutorialsplane

Codeigniter set default controller function


Codeigniter set default controller function: Codegniter default controller is defined in routs.php which means your contrlloer will be accessed when someone access your website- for example www.example.com then the default function will be called. Here in this article we are going to explain this with example.

Codeigniter set default controller function Example

Go to config.php/routs.php and add default controller there.


$route['default_controller'] = 'Welcome/index/$1';

For example if i access :


http://localhost

It will automatically call the welcome controller and index function.

http://localhost/Welcome/index