CodeIgniter Basic Tutorial
Performance & Utilities
CodeIgniter Advanced
Configuration in CodeIgniter means setting up your application’s basic options so that it works correctly.
It includes defining things like base URL, database settings, session handling, encryption keys, etc.
👉 In CodeIgniter, configuration files are located in:
application/config/
Each file handles a specific part of your app. Example:
config.php
→ General app settings (base URL, index file, etc.)database.php
→ Database connection settingsautoload.php
→ Libraries, helpers, packages to load automaticallyroutes.php
→ Application routing rulesconfig.php
(Main App Settings)Here you set basic application options.
Example:
$config['base_url'] = 'http://localhost/ci-app/'; $config['index_page'] = 'index.php'; $config['encryption_key'] = 'myStrongSecretKey123!';
base_url
→ Your project’s main URLindex_page
→ Default entry page (can remove using .htaccess)encryption_key
→ Important for sessions & securitydatabase.php
(Database Settings)This file stores DB connection details.
Example:
$db['default'] = array( 'hostname' => 'localhost', 'username' => 'root', 'password' => '', 'database' => 'ci_tutorial', 'dbdriver' => 'mysqli', );
autoload.php
(Auto Loading Components)If you want some libraries/helpers/models to load automatically, configure them here.
Example:
$autoload['libraries'] = array('database', 'session'); $autoload['helper'] = array('url', 'form');
routes.php
(Routing)Defines how URLs are mapped to controllers.
Example:
$route['default_controller'] = 'welcome'; $route['about'] = 'pages/about'; $route['contact'] = 'pages/contact';
constants.php
(App Constants)Used to define global constants like file paths, versions, etc.
Example:
define('SITE_NAME', 'My CodeIgniter Tutorial Site'); define('UPLOAD_PATH', 'uploads/');
config.php
.