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';
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]
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.