Wednesday, March 23, 2011

.htaccess & .htpasswd Files not Working in ubuntu

My solution to solve this is change /etc/apache2/sites-available/default

sudo vi /etc/apache2/sites-available/default
or
sudo nano ....
depending on your preference


You see something like:
Code:
<directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>

Change this to:
Code:
<directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>
and restart apache (sudo /etc/init.d/apache2 force-reload) and you see the .htaccess file is read and you are required to enter a username/password

No comments: