首页 > Web开发 > 详细

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

时间:2020-02-07 17:10:06      阅读:116      评论:0      收藏:0      [点我收藏+]

原来的地址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;
            }
        }

 

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

原文:https://www.cnblogs.com/dayin1/p/12272865.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!