nginx rewrite rule for codeigniter

This is my nginx configuration file, which obtain the assist from

Here are the few things you MUST take care:
1. All rewrite rule & root must set in server scope, NO location \{} nor ~\.php${} !!!
2. In codeigniter application/config/config.php file

  • set $config[‘index_page’] = “”;
  • set $config[‘uri_protocol’] = “REQUEST_URI”;

Here is the rewrite rule that you need

For more nginx rewrite rule, please visit