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

猜你喜欢

转载自zhong871004.iteye.com/blog/1185232