如何实现TP框架中index.php的隐藏?
- 内容介绍
- 文章标签
- 相关推荐
本文共计326个文字,预计阅读时间需要2分钟。
要隐藏tp隐藏index.php,可以按照以下步骤操作:
1. 找到并打开/public/.htaccess文件。
2.根据你的PHP环境,在文件中添加以下配置:
- 对于Apache环境,可以添加: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [L] - 对于Nginx环境,可以添加: location / { try_files $uri /public/index.php; }3.保存并关闭文件。
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框架》
以上就是tp如何隐藏index.php的详细内容,更多请关注自由互联其它相关文章!
本文共计326个文字,预计阅读时间需要2分钟。
要隐藏tp隐藏index.php,可以按照以下步骤操作:
1. 找到并打开/public/.htaccess文件。
2.根据你的PHP环境,在文件中添加以下配置:
- 对于Apache环境,可以添加: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [L] - 对于Nginx环境,可以添加: location / { try_files $uri /public/index.php; }3.保存并关闭文件。
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框架》
以上就是tp如何隐藏index.php的详细内容,更多请关注自由互联其它相关文章!

