ThinkPHP5.0隐藏入口文件 index.php

2025-09-12 00:39:31

1、一、根据自己下载的TP5.0安装包,进入到public目录下,找到.htaccess文件(一般官方下载都会有,没有的话,就自己新建一个.htaccess的文件),例如我放置的路径是: phpStudy/WWW/certificate/public/.htaccess

ThinkPHP5.0隐藏入口文件 index.php

2、二、打开.htaccess文件,把下面的这段代码(新建文件的话),放置到.htaccess的文件中

<IfModule mod_rewrite.c>

Options +FollowSymlinks

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]

</IfModule>

3、三、已存在.htaccess文件,并且文件中存在内容的话,RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] 将这里的 $1改成 s=$1即可

ThinkPHP5.0隐藏入口文件 index.php

4、四、然后在浏览器中输入,cert.com/index/index/index,cert.com是我自己在本地配置的虚拟域,最后访问成功,(^-^)V

ThinkPHP5.0隐藏入口文件 index.php

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢