CodeIgniter3配置rewrite

自用,备用

去除URL里面的index.php,同时需要配置框架config/config.php

index_page=''; 
$config['uri_protocol'] = 'PATHINFO';

Nginx虚拟机配置如下


server
        {
                listen       80;
                server_name [url]www.test.com[/url];
                index index.php index.html index.htm;
                root  /home/wwwroot;

                location ~ .*\.(php|php5)?$
                        {
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }
                
                location / {
                        index index.php;
                        if (-f $request_filename/index.php){
                                rewrite (.*) $1/index.php;
                        }
                        if (!-f $request_filename){
                                rewrite (.*) /index.php;
                        }
                }
        }

你可能感兴趣的:(CodeIgniter3配置rewrite)