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;
            }
        }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM