SoFunction
Updated on 2025-03-06

Analyze the rewrite rules of CI, namely the CodeIgniter framework under Nginx


server {

      listen      80;
       server_name   ;
       location / {
           root  d:/www/Codeigniter_2.0.1/;
           index  ;
       rewrite ^/$/ last;
       rewrite^/(?!index\.php|robots\.txt|images|js|styles)(.*)$ //$1last;
       }
    location ~^(.+\.php)(.*)$ {
      root     D:/www/Codeigniter_2.0.1/;
      fastcgi_index   ;
      fastcgi_split_path_info ^(.+\.php)(.*)$;
      fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name;
      fastcgi_param   PATH_INFO      $fastcgi_path_info;
      fastcgi_param   PATH_TRANSLATED   $document_root$fastcgi_path_info;
      fastcgi_pass   127.0.0.1:9002;
      include   fastcgi_params;
    }
}