I'd like to deny access to directory /foo/secret.

If I create a .htaccess file in /foo/secret, with...

<Directory ./>
        Order deny,Allow
        Deny from all
</Directory>

...I get a "500 Internal Server Error", which, while achieving the intended result, isn't the "403 Forbidden" message I was expecting.

I know you're supposed to put an absolute path in Directory directives but I'm committing this into a code repository and the remote client won't necessarily be running in the same path.

link|improve this question

75% accept rate
feedback

2 Answers

up vote 3 down vote accepted

Don't add <Directory ./> directive. .htaccess points to the directory itself. At least, that worked for me...

link|improve this answer
Perfect. Looks like my apache skills are rusty... thanks! – Julian H. Lam Apr 15 '11 at 18:22
Don't give up! Practice makes perfect. P.S. Why not mask the answer as correct? ;) – HUB Apr 15 '11 at 18:41
Why HUB, you just answered so quickly, Superuser wouldn't let me mark it as correct! :) – Julian H. Lam Apr 22 '11 at 23:43
feedback

.htaccess files are already in a directory, so that directive is non-applicable. Just skip it and go straight to your directives.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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