Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

my goal is to deny access to certain sub-directories. my localhost configuration allows overriding like that:

    <Directory />
            Options FollowSymLinks
            AllowOverride None
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all

I also have an .htaccess file in /var/www/ with contents:

    <Directory /var/www/*>
            Order allow,deny
            allow from all

Those rules above state access to everyone, but my server responds with internal error. "cat /var/log/apache2/error.log | tail -n 10" gives:

    [Thu Feb 23 12:41:09 2012] [alert] [client] /var/www/.htaccess: <Directory not allowed here"

Why is that so ? Any links on extensive guides on this problem are also extremely appreciated. Thanks.

share|improve this question

The error message is pretty clear. You must remove

<Directory> and </Directory>

from your .htaccess file. .htaccess is applied automatically for the directory you put it IN, so there should be NO need to reference <Directory> directives in your .htaccess. On top of that apache documentation clearly mentions that <Directory> directives have server config and virtual host scope ( - meaning you can only put them into httpd.conf (ie. main config) and within the <VirtualHost> directives

share|improve this answer

Your Answer


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.