tp如何隱藏index.php

tp隱藏“index.php”的方法:首先找到并打開“/public/.htaccess”文件;然后根據php環境分別設置“.htaccess”文件;最后保存修改即可。

tp如何隱藏index.php

TP5隱藏index.php

一,找到/public/.htaccess文件,如果你的入口文件已經移動到根目錄下,那么你的.htaccess文件也要剪切到根目錄下,總之要確保.htaccess跟入口的index.php保持同級。

二,根據你的php環境分別設置.htaccess文件:

apache

立即學習PHP免費學習筆記(深入)”;

<ifmodule> Options?+FollowSymlinks?-Multiviews RewriteEngine?on RewriteCond?%{REQUEST_FILENAME}?!-d RewriteCond?%{REQUEST_FILENAME}?!-f RewriteRule?^(.*)$?index.php/$1?[QSA,PT,L] </ifmodule>

phpstudy

<ifmodule>? 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框架

? 版權聲明
THE END
喜歡就支持一下吧
點贊9 分享