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'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.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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

share|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

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

share|improve this answer

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.