Actions

Mod rewrite

From zen2

Revision as of 01:19, 28 February 2012 by 10.1.1.1 (talk) (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…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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