There are two ways to enable mod_rewrite in Ubuntu systems:
First: After executing the sudo a2enmod rewrite instruction in the terminal, that is, the Mod_rewrite module is enabled, and the module of the APACHE2 server is enabled in the same way as the IP Multi domain name of the virtual host, all modules are etc/mods-available/folder, A2enmod rewrite This command is actually to link the module name to the/etc/apache2/mods-enabled/folder, (command: ls-la/etc/apache2/ mods-enabled/)
Open this module file (/etc/apache2/mods-enabled/rewrite.load) and look at:
See here, I believe everyone feels very familiar with it? Originally it is also defined a path, it is the real file is this:/usr/lib/apache2/modules/mod_rewrite.so, you go to see, found are garbled, do not control it, you can use on the line;
The second type: You can also open the Mod_rewrite module by connecting the/etc/apache2/mods-available/rewrite.load to the/etc/apache2/mods-enabled/rewrite.load. Its command is: sudo ln-s/etc/apache2/mods-available/rewrite.load/etc/apache2/mods-enabled/rewrite.load
A little hint. In fact, when I use the above approach in Ubuntu and restart the Apache service, I still can't rewrite the URL properly.
Here, there is one more thing to note: sudo vim/etc/apache2/sites-enabled/000-default will have the following: 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
Or, use the following command:
#service apache2 Restart (this method is recommended for restarting Apache2)
Source:http://hi.baidu.com/tonny_dxf/item/7701781b30cca15bf0090e50
Apache2 Server mod_rewrite Module open method [Linux, Ubuntu]