您的位置:首页 > 编程语言 > PHP开发

关于TP框架隐藏index.php

2017-12-04 18:17 381 查看
保证下面这些基础的东西都改掉

1. 确认httpd.conf配置文件中加载了mod_rewrite.so模块 

2. AllowOverride None 将None改为 All;允许读取.htaccess文件 

3. 打开Myapp/Conf/config.php文件,在配置的数组中添加一行: 

'URL_MODEL'=>2, 

4. 在入口文件所在的同级目录下,新建一个.htaccess文件,内容是: 

如果以上还不行的话,可以试试下面这些方法:

1、在.htaccess这个文件中,框架初始的内容是:

<IfModule mod_rewrite.c>
Options +FollowSymlinks

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

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

</IfModule>
只需要改成这样(只有最后一行有所改变):

<IfModule mod_rewrite.c>

Options +FollowSymlinks

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>

2、

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php