thinkphp如何隐藏入口文件index.php

1.说明(为什么需要隐藏index.php)

  • 在使用tp5框架的时候最烦人的就是那个入口文件index.php

  • 你使用方法的时候如果不在url中添加index.php项目就会无法运行很是烦人

  • 关键是不美观

2.首先找到你的项目中的public\.htaccess打开然后找到下面有index.php的这一行

在后面添加一个?号 

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

3.之后你就可以正常的使用你的项目了

猜你喜欢

转载自www.cnblogs.com/yaoliuyang/p/12410193.html
今日推荐