tp5.1 nginx环境下url去掉index.php

原来的地址http://xxxxxxx/index.php/admin/login/index.html

修改完的路径http://xxxxxxx/admin/login/index.html

修改.htaccess文件

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On
 
 
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>

添加nginx配置,如果使用的宝塔linux,直接在网址->单个网站设置->配置文件中合适的地方加上下面的代码即可

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