2011/05/27

How to enable .htaccess - Ubuntu 11.04

After you install LAMP, mode rewrite is not enabled. So in order to use .htaccess, you can do the following,

turn on RewriteEngine module

sudo a2enmod rewrite

allow directory to be overridden

Go to /etc/apache2/sites-available and edited the file "default" Change AllowOverride to All from none in Directory /var/www/.
NameVirtualHost *
<VirtualHost *>
        ServerAdmin admin@site.com

        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                # Commented out for Ubuntu
                #RedirectMatch ^/$ /apache2-default/
        </Directory>
Restart Apache by sudo /etc/init.d/apache2 restart You should be all set.

No comments:

Post a Comment