Difference between revisions of "Mod rewrite"
From zen2
(Created page with "==Enabling the module== In order to enable the mod_rewrite module in the Ubuntu server issue the following command: <pre> sudo a2enmod rewrite </pre> The above Apache2 Enable Mo…") |
m (1 revision) |
(No difference)
| |
Latest revision as of 08:08, 25 July 2013
Enabling the module
In order to enable the mod_rewrite module in the Ubuntu server issue the following command:
sudo a2enmod rewrite
The above Apache2 Enable Module command will add the correct line in the /etc/apache2/apache2.conf file. That is the only change you need to make with the apache2.conf file. Now it’s time to make a change to the document root.
In older versions of Apache all virtual host directory directives were managed in the /etc/apache2/apache2.conf file. This has changed. Now these alterations are handled within the /etc/apache2/sites-enabled/ directory. Within that directory you will find, by default, a single file called 000-default. If you open that file up for editing you will see, at the top, the two sections you need to edit in order to enable the rewrite engine for the document root of your Apache server.
First look in the <Directory /> section and change the line:
AllowOverride None
to
AllowOverride All
Do the same for the <Directory /var/www/> section.
Once you have the file edited, restart Apache with the command:
sudo /etc/init.d/apache2 restart
