Tuesday, June 28, 2016

Remove index.php from Codeigniter running on Nginx

  1. Edit your config.php file located at application/config/config.php Change value $config['uri_protocol'] = "AUTO"; to $config['uri_protocol'] = "REQUEST_URI";
  2. Put this line try_files $uri $uri/ /index.php?r=$request_uri; on nginx.conf file located at /etc/nginx/nginx.conf. The nginx.conf file should be like this: 
  3. location / {
           index  index.php;
           try_files $uri $uri/ /index.php?r=$request_uri;
    }
  4. Restart nginx service nginx restart
  5. Done!

No comments:

Post a Comment