Home Download Ubuntu

Enable mode-rewrite on Apache - Ubuntu

Enable mod-rewrite:

sudo a2enmod rewrite


Edit file /etc/apache2/sites-enabled/000-default and change AllowOverride None to AllowOverride All

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


Before:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>


After:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>


Now restart apache:

sudo /etc/init.d/apache2 restart


Resources: ComunitasWeb.com

5 comments:

halibutt said...

$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2 apache2: Syntax error on line 207 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/httpd.conf: Can't locate API module structure `mod_rewrite' in file /usr/lib/apache2/modules/mod_rewrite.so: /usr/lib/apache2/modules/mod_rewrite.so: undefined symbol: mod_rewrite
[fail]

:( Any ideas?

Speedy Gonzales said...

This error appeared after you made the changes as described above?
I'm just a beginner in Ubuntu, but you can always ask for help in ubuntu forums if I can't help you. These tutorials have been tested by me under Ubuntu server 9.10 and they worked just fine.

Speedy Gonzales said...

I just find out that sudo a2enmod rewrite just adds a .load file to /etc/apache2/mods-enabled/ that loads the module. If the command a2enmod rewrite did not worked, you can manually add the rewrite module by running:
sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/

Noel said...

Great! simple and functional! Well done!

mofohobo said...

that was awesome, thanks

Post a Comment