Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to password protect two directories with one user account in Apache. Will I need two Directory sections, or is there a way to combine them together?

share|improve this question
up vote 3 down vote accepted

You can do both using the DirectoryMatch directive (regex basic skills required)

share|improve this answer
This is what I'm looking for, thanks! – erimar77 Dec 15 '11 at 16:59

You could list two <Directory> sections, but refer to the same htpasswd file; is that what you meant…? I presume that these aren't a directory, and one that it also contains…

share|improve this answer
I was hoping to avoid two directory sections, it appears @thinice has pointed me in the right direction. – erimar77 Dec 15 '11 at 16:59

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.