×
新网 > 建站推广 > 正文

tp如何隐藏index.php

  • 作者:zccc
  • 来源:网络
  • 2020-07-06 12:04:01

tp隐藏“index.php”的方法:首先找到并打开“/public/.htaccess”文件;然后根据php环境分别设置“.htaccess”文件;最后保存修改即可。TP5隐藏index.php一,找到/public/.htacces

tp隐藏“index.php”的方法:首先找到并打开“/public/.htaccess”文件;然后根据php环境分别设置“.htaccess”文件;最后保存修改即可。

TP5隐藏index.php

一,找到/public/.htaccess文件,如果你的入口文件已经移动到根目录下,那么你的.htaccess文件也要剪切到根目录下,总之要确保.htaccess跟入口的index.php保持同级。

二,根据你的php环境分别设置.htaccess文件:

Apache:

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

phpstudy:

<IfModule mod_rewrite.c> 
Options +FollowSymlinks -Multiviews 
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1] 
</IfModule>

Nginx(在Nginx.conf中添加):

location / { // …..省略部分代码
    if (!-e $request_filename) {
        rewrite  ^(.*)$  /index.php?s=/$1  last;
        break;
    }
}

推荐学习:《thinkphp框架》

  • 相关专题

免责声明:本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,也不承认相关法律责任。如果您发现本社区中有涉嫌抄袭的内容,请发送邮件至:operations@xinnet.com进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。

免费咨询获取折扣

Loading