How to enable apache mod_rewrite on ubuntu
by rp
I have been moving my development to Linux lately and had the first real struggle getting the rewrite stuff working on Apache. Problem wasn’t that I didn’t know how to do it, (BTW usually i would prefer to have a self compiled version of Apache as I would know what’s in it) but that the configuration files were all so different from what I am used on Leopard and BSD etc.. Anyway so here’s what I did.
# sudo a2enmod rewrite # sudo /etc/init.d/apache2 restart
To disable an Apache 2 module, you can run:
# sudo a2dismod rewrite # sudo /etc/init.d/apache2 restart
That does the reverse.
With mod_rewrite enabled, you can use the .htaccess file.By the way in your directory permissions, you must set AllowOverride to “all” like this:
[config]
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
[/config]
HTH
.htaccess files are known to cause performance issues on large sites, so I would discourage their usage in production.