After clean installation of CodeIgniter 2.x framework (e.g. to localhost) I recommend following steps:
1) Setup ‘base_url’ to application
- open /application/config/config.php
- change base_url (e.g. $config[‘base_url’] = ‘http://localhost/mydomain/’;)
2) Give up index.php from URL
- create .htaccess file in to root of the project (e.g. mydomain) + edit RewriteBase /mydomain/
- open /application/config/config.php
- and change index_page to $config[‘index_page’] = ”;
3) Change default controller
- open /application/config/routes.php
- change default_controller (e.g. $route[‘default_controller’] = “itemlist”;)
4) Setup autoload of database
- open /application/config/autoload.php
- change libraries to $autoload[‘libraries’] = array(‘database’);
- open /application/config/database.php
- setup parameters for database (DB) connection
5) Set up form protection
- open /application/config/config.php
- set csrf_protection ($config[‘csrf_protection’] = ‘TRUE’;)
6) Turn on using of sessions
Comment: Relevant only when we need to use user’s registration & login.
- open /application/config/config.php
- set encryption_key (e.g. $config[‘encryption_key’] = ‘SomeEncryptionKey’;)
- if you want to set your sessions to DB then:
- set sess_use_database ($config[‘sess_use_database’] = ‘TRUE’;)
- set sess_table_name (e.g. $config[‘sess_table_name’] = ‘ci_sessions’;)
Recent Comments