Apache:
1. httpd.conf配置文件中加载了mod_rewrite.so模块
2. AllowOverride None 将None改为 All
3. 把下面的内容保存为.htaccess文件放到应用入口文件的同级目录下
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?/$ [QSA,PT,L] </IfModule>
PHP5.5以上
[Apache]规则这一行:
RewriteRule ^(.*)$ index.php/$ [QSA,PT,L]
会导致报错:
需要修改成:
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$]
;