4

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.

2 Answers 2

5

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

4
  • Perfect. Looks like my apache skills are rusty... thanks! Commented Apr 15, 2011 at 18:22
  • Don't give up! Practice makes perfect. P.S. Why not mask the answer as correct? ;) Commented Apr 15, 2011 at 18:41
  • Why HUB, you just answered so quickly, Superuser wouldn't let me mark it as correct! :) Commented Apr 22, 2011 at 23:43
  • You'd better put the correct content, but not some modifications Commented Oct 31, 2022 at 19:07
1

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.