Defining a Default Controller in CI

Mostly this is info from the UG.

CodeIgniter can be told to load a default controller when a URI is not present, as will be the case when only your site root URL is requested. To specify a default controller, open your application/config/routes.php file and set this variable:

$route['default_controller'] = 'Blog';

Where Blog is the name of the controller class you want used. If you now load your main index.php file without specifying any URI segments you’ll see your Hello World message by default.

I guess it doesn’t matter if it’s blog or Blog. I’ve seen it work both ways in this UG.


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