1.在apache配置文件http.conf中LoadModule rewrite_module modules/mod_rewrite.so
前面没有#

2.<Directory "../htdocs">目录为项目目录(.htaccess url规则所在目录)

3.在编辑器中新建一个文件。rewrite规则:

<IfModule mod_rewrite.c>
RewriteEngine on

#不显示index.php

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

</IfModule>
文件保存,命名为.htaccess

4.thinkphp配置文件config中

'URL_MODEL'=>2,

2就是url开启rewrite规则。


这样原本路径 http://localhost/index.php/index/index

就能是伪静态的 http://localhost/index/index