codeigniter Installation and Setup


Windows Environment

  1. Install XAMPP or WAMP
  2. Download and Unzip the package from
  3. Extract all the document in the server space (htdocs or www directory)

Mac Environment

  1. Install MAMP
  2. Download and Unzip the package from
  3. Extract all the document in the server space (htdocs)

Linux Environment

  1. Download and Unzip the package from
  2. Place the extracted folder in /var/www (in WAMP) or xampp/htdocs (XAMPP)


git clone

If you follow the system correctly, you will get the below screen.

enter image description here

Base URL

  1. Go to application/config/config.php
  2. Define base URL as $config['base_url'] = 'http://localhost/path/to/folder';

Remove index.php from URL

Apache Configuration
  1. go to root

  2. create htaccess file

  3. Add below code inside it

    RewriteEngine on
    RewriteCond $1 !^(index\.php|assets|image|resources|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Note: .htaccess code vary depending on hosting server. In some hosting server (e.g.: Godaddy) need to use an extra ? in the last line of above code. The following line will be replaced with last line in applicable case:

RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
Nginx Configuration
  1. Open nginx config file (by default: /etc/nginx/sites-available/default)

  2. Add below code inside it

    server {
       server_name domain.tld;
       root /path-to-codeigniter-folder; //you codeigniter path
       index index.html index.php;
       # set expiration of assets to MAX for caching
       location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
            expires max;
            log_not_found off;
       location / {
            # Check if a file or directory index file exists, else route it to index.php.
            try_files $uri $uri/ /index.php;
       location ~* \.php$ {
            include fastcgi.conf;

Database Configuration

  1. Go to application/config/database.php
  2. Set the following configuration variables.
    • Host
    • Username
    • Password
    • Database Name
    • Port

Set Default Controller

  1. Go to application/config/routes.php
  2. set the following configuration variable value with your controller name.
    • default_controller

AutoLoad Library And Helper

  1. Go to application/config/autoload.php
  1. set Auto load value like $autoload['libraries'] = array('database', 'session');
  2. set Helper value like $autoload['helper'] = array('url', 'file', 'form', 'html', 'text');