Nginx配置-伪静态,隐藏index.php入口

1、在网站根目录(入口文件同目录下)添加下面内容保存为.htaccess文件

       
                Options +FollowSymlinks -Multiviews
                RewriteEngine on

                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
        

2、在nginx对应的配置文件的http{ server{ } }里写如下代码,在原来localtion / {}里面写

        
                if (!-e $request_filename){
                        rewrite ^(.*)$ /index.php?s=$1 last;break;
                 }

你可能感兴趣的:(Nginx配置-伪静态,隐藏index.php入口)