Codeigniter Project Directory Structure

Today, We want to share with you codeigniter folder structure.In this post we will show you codeigniter mvc architecture, hear for codeigniter configure the folder structure we will give you demo and example for implement.In this post, we will learn about codeigniter tutorial with an example.

CodeIgniter – Application Architecture

CodeIgniter file structure is mainly divided into three parts:

  • Application
  • System
  • User_guide

Default Directories

install has six directories: /app, /system, /public, /writable, /tests and possibly /docs.

Application directory in CodeIgniter

/app
        /Config         
        /Controllers    
        /Database       
        /Filters        
        /Helpers        
        /Language       
        /Libraries      
        /Models         
        /ThirdParty     
        /Views          

Folder structure:

β”œβ”€β”€ Codeigniter
β”‚   β”œβ”€β”€ applications
β”‚   β”‚   β”œβ”€ front-end
β”‚   β”‚   β”‚   β”œβ”€β”€ views
β”‚   β”‚   β”‚   β”œβ”€β”€ models
β”‚   β”‚   β”‚   β”œβ”€β”€ controllers
β”‚   β”‚   β”‚   β”œβ”€β”€ config
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€ back-end
β”‚   β”‚   β”‚   β”œβ”€β”€ views
β”‚   β”‚   β”‚   β”œβ”€β”€ models
β”‚   β”‚   β”‚   β”œβ”€β”€ controllers
β”‚   β”‚   β”‚   β”œβ”€β”€ config
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”‚
β”‚   β”œβ”€β”€ system
β”‚   β”‚   β”œβ”€β”€ core
β”‚   β”‚   β”œβ”€β”€ database
β”‚   β”‚   β”œβ”€β”€ helpers
β”‚   β”‚   └── ...
β”‚   β”‚   
β”‚   β”œβ”€β”€ index.php
β””   └── backend.php
 

Codeigniter Configuration

update application_folder config:

//index.php
$application_folder = 'applications/front-end';

//backend.php
$application_folder = 'applications/back-end';

Free Live Chat for Any Issue

multiple controllers in your module

app_name_module
- controller
  - home.php
  - admin/admin_dashboard.php
- model
  - model.php
- view
  - home_view.php
  - admin/admin_view.php

To access the modules
echo Modules::run('app_name_module/home/methodname');

echo Modules::run('app_name_module/admin/admin_dashboard/methodname');

codeigniter folder structure on webserver

application/
system/
public_html/
    index.php

Increase security by hiding the location of your CodeIgniter files

β”œβ”€β”€ CodeIgniter 
β”‚   β”œβ”€β”€ application
β”‚   β”œβ”€β”€ system
β”‚   β”œβ”€β”€ wwwroot
β”‚   β”‚   β”œβ”€β”€ index.php

For Linux/Apache:

$application_folder = './application';
$system_path = './system';

For Windows/IIS:

$application_folder = '../application/';
$system_path = '../system/';

Set Base URL

Go to application/config/config.php

//Define base URL as 

$config['base_url'] = 'http://localhost/path/to/folder';

Remove index.php from URL

.htaccess file

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]

Download

I hope you get an idea about Codeigniter displays file structure on localhost.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.