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

( 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?


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.

  • Well, that worked. But it also locked me out. I still have the 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? 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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