现在很多项目
http://www.test.dev/index.php/home/index
http://www.test.dev/index.php?s=/admin/login
等等
如何访问 http://www.test.dev/index.php/home/index 相当于自动访问 http://www.test.dev/home/index
省略中间的index.php呢?
1 在windows的php apache环境中开启conf的httpd.conf 找到LoadModule rewrite_module modules/mod_rewrite.so的#号去掉
2 AllowOverride None 修改为 AllowOverride All
3 目录创建的.htaccess 增加以下内容
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
#RewriteRule . index.php
RewriteCond %{REQUEST_FILENAME} ^[A-Z]{3,}\s(.*)/index.php [NC]
</IfModule>
然后重启apache