thinkphp3 隐藏index.php

首先修改配置文件:

'URL_CASE_INSENSITIVE' => true, // 默认false 表示URL区分大小写 true则表示不区分大小写
'URL_MODEL' => 2, // URL访问模式,可选参数0、1、2、3,代表以下四种模式:
// 0 (普通模式); 1 (PATHINFO 模式); 2 (REWRITE 模式); 3 (兼容模式) 默认为PATHINFO 模式 

Apache

在根目录新建.htaccess文件:

1

2

3

4

5

6

7

<IfModule mod_rewrite.c>

Options +FollowSymlinks

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

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

</IfModule>

注意:尽管这样配置了,但是直接访问域名时还是会出现新建站点的界面,这时要检查根目录下是否有Index.html,去掉就可以了

猜你喜欢

转载自blog.csdn.net/qq_40270754/article/details/85930899