Password protect directory with htaccess

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Password protect directory with htaccess

Post by shiznatix »

I have setup password protected directories through htaccess several times but for some reason it is not working this time. I have a fresh install of Ubuntu and I have been trying to get my local install of apache to password protect the web root so basically you can't access my computers webserver without a password.

I have this in my /etc/apache2/apache2.conf file:
<Directory /var/www>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
This in my .htaccess file located in /var/www/
AuthName "Bork Bork"
AuthType Basic
AuthUserFile /var/www/.htpasswd
Require user panda
This in my .htpasswd file located in /var/www/
panda:/feedpd9kra8E
But no matter what I do (yes, i restarted apache by sudo /etc/init.d/apache2 restart) but nothing. It won't prompt me for a password or anything. What in the world am I doing wrong here??
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

Hm, strange ...
Check this line:

Code: Select all

AccessFileName .htaccess
in your httpd.conf
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

Also, add:

Code: Select all

Satisfy All

in your .htaccess file.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply