git clone https://github.com/bcit-ci/CodeIgniter.git
If you follow the system correctly, you will get the below screen.
application/config/config.php
$config['base_url'] = 'http://localhost/path/to/folder';
index.php
from URLApache Configuration |
---|
go to root
create htaccess file
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 |
---|
Open nginx config file (by default: /etc/nginx/sites-available/default
)
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$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
}
}
application/config/database.php
application/config/routes.php
application/config/autoload.php
$autoload['libraries'] = array('database', 'session');
$autoload['helper'] = array('url', 'file', 'form', 'html', 'text');