TP中如何去掉index.php

使用过TP的同学都知道,在URL始终会有index .php  我们如何才能够去掉呢?
1. 确认httpd.conf配置文件中加载了mod_rewrite.so模块
2. AllowOverride None 将None改为 All;允许读取.htaccess文件
3. 打开Myapp/Conf/config.php文件,在配置的数组中添加一行:
'URL_MODEL'=>2,
4. 在入口文件所在的同级目录下,新建一个.htaccess文件,内容是: 


<IfModule mod_rewrite.c>  
RewriteEngine on  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]  
</IfModule> 

  

 

posted @ 2017-04-27 14:45  骑着蜗牛闯世界  阅读(3653)  评论(0编辑  收藏  举报