日期:2014-05-17  浏览次数:20379 次

thinkphp 去掉index.php

去掉URL里面的index.php?是为了SEO的需要,需要服务器开启URL_REWRITE模块。
下面的配置过程可以参考下:
1 ?httpd.conf配置文件中加载了mod_rewrite.so模块

??#LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉
2??AllowOverride?None?将None改为?All

?

<Directory "cgi-bin">

? ? AllowOverride All

? ? Options None

? ? Order allow,deny

? ? Allow from all

</Directory>

3 ?确保URL_MODEL设置为2

?return Array(
? ? ?'URL_MODEL' => '2',
? );

4 把.htaccess文件放到入口文件的同级目录下(路径为phpmyadmin\libraries)
<IfModule?mod_rewrite.c>
RewriteEngine?on
RewriteCond?%{REQUEST_FILENAME}?!-d
RewriteCond?%{REQUEST_FILENAME}?!-f
RewriteRule?^(.*)$?index.php/$1?[QSA,PT,L]
</IfModule>

ps:在windows下不能建立以点开头的文件,你可以先随便建立一个文件

然后在DOS在操作 rename xxxx.xxxx?? .htaccess

?

1 楼 Jocson 2011-11-22  
不知道我的为什么还是行啊,已经按照你写的操作了啊,能详细说明一下吗,帮我改正一下。
2 楼 Jocson 2011-11-22  
[img][/img]
3 楼 zhong871004 2011-12-31  
Jocson 写道
[img][/img]

你的问题出在哪里了