Executing in the terminal
sudo a2enmod rewrite
command, the Mod_rewrite module is enabled.
Alternatively, you can open the Mod_rewrite module by connecting the/etc/apache2/mods-available/rewrite.load to the/etc/apache2/mods-enabled/rewrite.load. The command operation is:
sudo ln-s/etc/apache2/mods-available/rewrite.load/etc/apache2/mods-enabled/rewrite.load
A little bit of hints
In fact, when I did this in Ubuntu and restarted the Apache service, I still couldn't rewrite the URL properly. Here, there is one more thing to note:
sudo vim/etc/apache2/sites-enabled/000-default
Will be one of:
AllowOverride None
Modified to:
AllowOverride All
The above/etc/apache2/sites-enabled/000-default is actually a/etc/apache2/sites-available/default connection. The Allowwoverride None will completely ignore the. htaccess file, and naturally the rewrite rules defined therein will not take effect.
Finally, don't forget to restart Apache using the following instructions:
Sudo/etc/init.d/apache2 restart
Http://www.jb51.net/article/39524.htm
How to launch Apache's rewrite feature under Ubuntu