[Ubuntu] how to use url-rewrite 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 

 

 

 

posted @ 2011-09-21 11:23  DavidHHuan  阅读(275)  评论(0编辑  收藏  举报