Codeigniter Rewrite for nginx & apache

Rewrite Rules for nginx must be added into each domain’s configuration.

location /path/to/project{
    try_files $uri $uri/ /path/to/project/index.php?/$request_uri;
}

Rewrite Rules for apache can be added in the project’s .htaccess.

RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]

You may also like...