Configuring your website base URL

The base URL of the CodeIgniter website can be configured in application/config/config.php file. It is URL to your CodeIgniter root. Usually, this will be your base URL, with a trailing slash e.g.

CodeIgniter will try to the protocol, domain and path to your installation. However, configure on auto guessing especially in production environments. You can configure the base URL in the $config array with key base_url as following

$config['base_url'] = '';

Database Configuration

CodeIgniter has a config file that lets you store your database connection values like username, password, database name, etc. The config file is located at application/config/database.php. Also you can set Database Connection values for specific environments in database.php it's the respective environment config folder.

In the CodeIgniter config settings are stored in a multidimensional array with this prototype :

$db['default'] = array( 
   'dsn'   => '', 
   'hostname' => 'localhost', 
   'username' => 'root', 
   'password' => '', 
   'database' => 'database_name', 
   'dbdriver' => 'mysqli', 
   'dbprefix' => '', 
   'pconnect' => TRUE, 
   'db_debug' => TRUE, 
   'cache_on' => FALSE, 
   'cachedir' => '', 
   'char_set' => 'utf8', 
   'dbcollat' => 'utf8_general_ci',
   'swap_pre' => '', 
   'encrypt' => FALSE, 
   'compress' => FALSE, 
   'stricton' => FALSE, 
   'failover' => array() 

hostname : The hostname of your database server. Often this is "localhost".

username : Set username of your database here.

password : Set password of your database here.

database : Set name of the database here.

dbdriver : The database type. ie: mysql, postgres, odbc, etc. Must be specified in lower case.

Autoload Configuration

CodeIgniter Auto-load feature helpers, libraries, and models to be initialized automatically every time the system runs. If you want certain resources globally your application you should consider auto loading them for convenience. Following are the things you can load automatically.

CodeIgniter autoload resources, open the application/config/autoload.php file and add the item you want loaded to the autoload array.

$autoload['libraries'] = array('database', 'email', 'session');
$autoload['drivers'] = array('cache');
$autoload['helper'] = array('url', 'file');
$autoload['config'] = array('config1', 'config2');
$autoload['model'] = array('first_model', 'second_model');