Apache2 Server mod_rewrite Module open method [Linux, Ubuntu]

Source: Internet
Author: User

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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.