[Ubuntu] how to use urlrewrite in apache2

just follow the steps below:

First step: 

sudo vim /etc/apache2/sites-available/default

Modify the code from

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

to

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

 <Directory />

    Options FollowSymLinks
    AllowOverride All
</Directory>

Second step:

sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

sudo ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load

sudo ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_http.load

Then restart the apache2:

sudo /etc/init.d/apache2 restart

you now can use .htaccess to achieve the url rewrite 

原文地址:https://www.cnblogs.com/davidhhuan/p/2183683.html