1.开启rewrite模块,使用命令:a2enmod rewrite
2.在apache2.conf,配置你网站的目录(是目录而定)
3.在你的网站目录下添加去掉index.php的.htaccess(分布式配置文件)
RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
4.重启apache. service apache2 restart .即可实现