Home > Backend Development > PHP Tutorial > How to start Apache's Rewrite function under Ubuntu_PHP tutorial

How to start Apache's Rewrite function under Ubuntu_PHP tutorial

WBOY
Release: 2016-07-21 15:01:24
Original
681 people have browsed it

Execute in terminal

sudo a2enmod rewrite

After the

directive, the Mod_rewrite module is enabled.

Alternatively, you can turn on the Mod_rewrite module by connecting /etc/apache2/mods-available/rewrite.load to /etc/apache2/mods-enabled/rewrite.load. Use the command to operate:

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

A little tip

In fact, when I adopted the above approach in Ubuntu and restarted the Apache service, I still could not rewrite the URL normally. Here, there is something else that needs attention:

sudo vim /etc/apache2/sites-enabled/000-default

Replace:

AllowOverride None

is modified to:

AllowOverride All

The /etc/apache2/sites-enabled/000-default above is actually the connection to /etc/apache2/sites-available/default. AllowwOverride None will completely ignore the .htaccess file, and naturally the rewrite rules defined in it will not take effect.

Finally, don’t forget to restart Apache using the following command:

sudo /etc/init.d/apache2 restart.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327999.htmlTechArticleAfter executing the sudo a2enmod rewrite command in the terminal, the Mod_rewrite module is enabled. Alternatively, you can connect /etc/apache2/mods-available/rewrite.load to /etc/apache2/m...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template