Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 3 webapps running on my machine on different ports like:


If I add to my httpd.conf:

<Location "/">
AuthUserFile /my/file/with/users
AuthName "This is a protected area"
AuthGroupFile /dev/null
AuthType Basic
Require valid-user

The authentication works fine, but I want to be able to have Apache authentication only when the user enters "xxx.domain.com" and not yyy/zzz, is it possible without using .htaccess files and the <Location>?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

yes, use virtual hosts: http://httpd.apache.org/docs/2.2/vhosts/

share|improve this answer
add comment

Yes, you can do it by putting in the Directory directive (into VirtualHost) instead of using .htaccess.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.