Ubuntu Apache2开启mod_rewrite解决laravel路由失效问题
1.开启rewrite模块;
$sudo a2enmod rewrite
或
$sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
2.修改/etc/apache2/sites-available/000-default(默认),将<Directory>的AllowOverride None修改为AllowOverride All;如果是VirtualHost,可以增加相应的<Directory> ,例如:
<Directory "/var/www/html">
AllowOverride All
</Directory>
3、修改/etc/apache2/apache2.conf,将<Directory>的AllowOverride None改为AllowOverride All;
4、重启apache2服务
$ sudo /etc/init.d/apache2 restart。