Nginx CodeIgniter remove index.php in the URL
I have finally solved a rewrite problem. What it's important, Plesk generates default parameters in Nginx configuration file, any changes inside that file is temporary.
To remove index.php in CodeIgniter projects, just add this code for each project in the Plesk>Domains/example.com/Web Server Settings:
location /category/subcategory { try_files $uri $uri/ /category/subcategory/index.php; }
and remove index.php parameter in CodeIgniter config.php:
$config['index_page'] = '';$config['uri_protocol'] = 'REQUEST_URI';
SOLVED
If my project folder is /ci inside /html directory under nginx,
The above answer by @ikxi worked to open the page like
http://localhost/ci/welcome
However it was not opening index.php
if i just type
http://localhost/ci/
But this solution worked perfectly for me adding nginx.conf
file.
Find something like this:
// This lines will be therelocation / { root html; index index.html index.htm index.php;}// just keep above as it is.. (or you can add "index.php")
Add below lines after it:
location /ci { index index.html index.htm index.php; try_files $uri $uri/ /ci/index.php; }