Resume
This passage will introduce how to enable rewrite in Apache.
a2enmod
a2enmod
is a command that allows us to enable mods in Apache. So we will use this command to enable rewrite.
Just type a2enmod rewrite
in the Terminal to enable rewrite.
vhost file
In some situations, we will have to add
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory THE_PATH_OF_YOUR_SITE><!-- Replace with the path of your site ->
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
to your config file in /etc/apache2/sites-available/yoursite.local.conf
or /etc/apache2/sites-available/000-default.conf
(If you have to modify 000-default.conf
, the Directory tag should be <Directory />
).