具體操作是:
sudo a2enmod
- 1
終端提示可以使用的模塊名稱,此時輸入
rewrite
- 1
提示成功加載rewrite模塊,然後修改apache2的配置文件
cd /etc/apache2
sudo vim apache2.conf
- 1
- 2
然後將
<Directory /var/www/>
Options Indexes FollowSymlinks
AllowOverride None
Require all granted
</Directory>
- 1
- 2
- 3
- 4
- 5
中的AllowOverride None
改爲AllowOverride
All
然後重啓apache即可
sudo /etc/init.d/apache2 restart
轉載http://blog.csdn.net/monsterjohn/article/details/47090917