0

I want clients to be denied automatic directory listings, other than those from specific ip addresses.

What should I put in my virtual host conf file?

I've tried

<Directory "/var/www/myvirtualhost/">
  Options +Indexes
  allow from 1.2.3.4
</Directory>

but it has the effect of allowing directory listings for everybody.

1 Answer 1

0

If I'm not mistaken, you need to specifically deny everyone. An example of how we set it up at my work would be:

<Directory /path/to/your/dir>  
  Options indexes   
  order deny,allow  
  deny from all
  allow from 1.2.3.4
</Directory>

So you would need to add the order line and the deny line

1
  • thanks Bethsabet but those settings deny all users access to all files, even those whose full url is known. Except clients coming from 1.2.3.4
    – twisted
    Commented Apr 26 at 9:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.