首先启用Apache的rewrite模块
sudo ln /etc/apache2/mods-enabled/rewrite.load /etc/apache2/mods-available/rewrite.load
然后启用服务器的AllowOverride
sudo kate /etc/apache2/sites-enabled/000-default
更改如下
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
也需要在DocumentRoot打开AllowOverride:
<Directory /var/www/html>
# ... other directives...
AllowOverride All
</Directory>
最后重启Apache即可
sudo service apache2 restart