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

www.myDomainName.com/static

I get:

Forbidden

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

GREAT!

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

www.ipOfMyDomainName.com/static

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
    </Directory>
share|improve this question
    
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
add comment

1 Answer

up vote 0 down vote accepted

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

Options All Indexes FollowSymLinks MultiViews
share|improve this answer
    
My httpd.conf file is an empty file. –  Hunter Feb 28 '11 at 13:35
    
I've updated my question, and I accept your answer. –  Hunter Feb 28 '11 at 13:38
add comment

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.