Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm trying to make it so that the outside world can't access a specific section of my website. What I did was:

<Directory /Library/WebServer/.../secrets/>
     Order deny,allow
     Deny from all
     Allow from 10.0.1.18
</Directory>

(10.0.1.18 is my computer's internal IP) That seemed to work for the root folder, but not for subfolders. So I tried secrets/* in the directory block, but that disabled everything. Anyone could access the secrets folder.

How would I make the directory block apply to subfolders?

share|improve this question

1 Answer 1

According to this:

<Directory> and </Directory> are used to enclose a group of directives that will apply only to the named directory, sub-directories of that directory, and the files within the respective directories.

So if you omit the trailing slash then this should work:

<Directory /Library/WebServer/.../secrets>

secrets/* means subdirectories and files below the secrets directory, not the directory itself.

share|improve this answer
    
Well, that worked. But it also locked me out. I still have the 10.0.1.18 ip address... Could it be that the secrets folder is a web app? (phpMyAdmin) –  Cole Oct 13 '11 at 23:28
    
Can you get to the phpMyAdmin login screen or can't you even see that? –  paulmorriss Oct 14 '11 at 11:46
    
No, I can't see that. I just get the "access forbidden" page. –  Cole Oct 14 '11 at 21:42

Your Answer

 
discard

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.