在登陆thinkphp入口时,通常需要加入域名/index.php/xxx才能正常访问,如果要将index.php去掉,需要将public目录下的.htaccess文件中:
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
修改为:
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
就是加了一个?
就可以去掉index.php访问相应目录文件了。
如果使用多个入口文件,也可使用这个方式。