How do I enable Rewrite under Ubuntu
- 2020-07-21 07:07:16
- OfStack
Execute in the terminal
sudo a2enmod rewrite
After the instruction, the Mod_rewrite module is enabled.
You can also open the Mod_rewrite module by connecting /etc/apache2/ mods-ES13en/rewrite.load to /etc/apache2/ mods-ES19en/rewrite.load. The operation with the instruction is:
sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
1 tip
In fact, when I did this in Ubuntu and restarted the Apache service, the rewrite url still didn't work. Here's one more thing to note:
sudo vim /etc/apache2/sites-enabled/000-default
Put among them:
AllowOverride None
Is amended as:
AllowOverride All
The above /etc/apache2/sites-enabled/ 000-ES53en is actually the connection of /etc/apache2/ ES56en-ES57en /default. AllowwOverride None will ignore the.htaccess file completely and the rewrite rule defined in it will not take effect.
Finally, don't forget to restart Apache with the following instructions:
sudo /etc/init.d/apache2 restart.