I'm using Apache 2.2.

In the var/www directory I've created a .htaccess file that contains this:

Options -indexes

When I reach my site and want to see the directories and files like this:


I get:


You don't have permission to access /static/ on this server


But, when I type the concrete IP address of my site like this:


I get:

Index of /static/

and I can see the whole directory structure and all the files.

How can I solve this? So nobody can see my files and directories.

UPDATE: So, I'm using virtual host and I had to delete "Indexes" from the file named "default" in the site-available directory

now it contains this:

<Directory /var/www/>
        Options FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
  • Probably not related, but shouldn't the I in indexes be capitalized? "Options -Indexes" – ed209 Feb 28 '11 at 13:29
  • Are you sure you are accessing the same server?! – Khaled Feb 28 '11 at 13:31
  • Yes, I'm accessing the same server. I've changed it to "I" but it doesn't work. – Hunter Feb 28 '11 at 13:33
  • Is there a way of changing the 403 to a 404 as well. I have a similar problem, but want to prevent the existence of a directory being detected. – Rik Heywood Feb 28 '11 at 13:47

Try removing "Indexes" in this line in your httpd.conf. If that doesn't work, try removing "All" too.

Options All Indexes FollowSymLinks MultiViews
  • My httpd.conf file is an empty file. – Hunter Feb 28 '11 at 13:35

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.