.htpasswd and Alias Directory

I have to restrict the access of a directory using the .htaccess and .htpasswd files.
When I use it for a directory that is in the directory root all is fine, when I try to use it for a dierctory out of the root it dosen't work.

In the httpd.conf I use Alias /www/ "/databases/www/"

if I create a pippo.htm file I can see it.
Now I create the .htaccess file like the other way:

AuthName "Alpha_Web"
AuthType Basic
AuthUserFile /databases/www/.htpasswd
require valid-user

and the .htpasswd file:
pippo:68DnE1HvzmjoI

but no auth is required. I move this 2 file in another folders that is in the directory root chaning only the .htaccess pointer all works fine.

So how can I use the Apache .htpasswd restriction password system with a directory out of the directory root???

Thanks and sorry for my english
Daniele
giropizzaAsked:
Who is Participating?
 
ee_ai_constructConnect With a Mentor Commented:
Question answered by asker or dialog valuable.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0
 
giropizzaAuthor Commented:
I found it:
I have to use the httpd.conf:

    Alias /www/ "/databases/www/"

    <Directory "/databases/www/">
     Options Indexes
     AuthType Basic
     AuthName "Alpha_Web"
     AuthUserFile "/databases/www/.htpasswd"
     Require valid-user
     </Directory>

Bye bye
Daniele
0
 
periwinkleCommented:
Daniele -

FWIW, you probably didn't have Options AllowOverride for this directory prior to putting the auth information into the httpd.conf - that meant that you couldn't override the httpd.conf using an .htaccess file.
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
giropizzaAuthor Commented:
no, now all is ok, both on the "internal" directory and the "external".

Daniele
0
 
samriCommented:
PAQ/refund ?
0
 
periwinkleCommented:
Yes - it should be.  Daniele, as this isn't an abandoned question, you should post a question in Community Support:

http://www.experts-exchange.com/Community_Support/

requesting that the question is closed as PAQ/refund with a link to this question.

0
All Courses

From novice to tech pro — start learning today.