之前apache2的url重写一直开不起来,也搜了很多资料但都没有用。
最近终于找到了解决方法,其实很简单:
只需要
| 1 | vim /etc/apache2/sites-available/000-default.conf | 
| 1 | 然后修改 | 
| 1 2 3 4 5 6 7 8 9 10 | <VirtualHost *:80>     <Directory /var/www/html/>         Options FollowSymLinks         #AllowOverride None     把None改为All使.htaccess作用在所有地方         AllowOverride All         Require all granted     </Directory>     . . . </VirtualHost> | 
最后,最关键的一步:
| 1 2 3 |     a2enmod rewrite   //开启扩展,apache2专用     //或使用 ln -s /etc/apache2/mods-cuailable/rewrite.load  /etc/apache2/mods-enabled/rewrite.load     service apache2 restart | 
然后就可以开心的使用啦!
 。
。