Configuration: config.php
In general configuration, you can change the default value of base url.
<?php
$site = 'http://'.$_SERVER['HTTP_HOST'].'/';
$sene_method = 'PATH_INFO';//REQUEST_URI,PATH_INFO,ORIG_PATH_INFO
The $site
variable should have trailing slash on last char to work properly.
The $sene_method
variable PATH_INFO value used on Localhost environment like on XAMPP. REQUEST_URI value used on Server Production like Nginx, Apache2, or Litespeed. This configuration also depend on .htaccess file and server configuration.
The .htaccess
Here is the example of .htaccess file if used on root folder.
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Sub Directory
The .htaccess on subfolder if the default one not working, you can use this option.
RewriteEngine on
RewriteBase /appfolder/
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /appfolder/index.php/$1 [L]
Nginx Configuration
If you using nginx, you can just add this code to location /. Before that, you have to define index first and then ad try_files on location /.
#define index first if not yet
index index.php;
location / {
#autoindex on;
try_files $uri $uri/ /index.php?$args;
}