TP5去除URL中index.php

TP5.1如何去除URl里面的(index.php)

例如:http://www.shopping.cn/index.php /admin/login.html
在这里插入图片描述

具体操作如下:
在public同级目录下 .hatccess 文件中编辑以下代码:

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


在这里插入图片描述

具体可关注 ThinkPHP5.1完全开发手册>>URL访问>>URL重写
注意要将’/‘换成’?’ 方可实现

实现结果如下

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_44796093/article/details/108192331