How to hide directory contents

Janitor_Willie

New Member
Anyone know how you prevent casual web surfers from viewing the contents of a directory? I sometimes come across sites that will display an image that resides inside of a directory, but I you try to go directly to the directory it gives you this error....

This Virtual Directory does not allow contents to be listed.
 

Janitor_Willie

New Member
That worked for my primary domain but not my addon domains.

I added this as the very last line of code of the .htacess file in the public_html folder...
Options -Indexes

I noticed that it also affected the .htaccess file in the www folder.

Here's the exact code of the .htaccess file as I edited...

# -FrontPage-

AuthUserFile /home/myusername/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/myusername/public_html/_vti_pvt/service.grp

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.myprimarydomainname.com
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
RewriteEngine On
RewriteCond %{HTTP_HOST} ^myprimarydomainname.com
RewriteRule (.*) http://www.myprimarydomainname.com/$1 [R=301,L]
Options -Indexes
 
Last edited:

chrishirst

Well-Known Member
Staff member
index.htm | index.html | index.php or whatever is in the IndexFiles list in httpd.conf or .htaccess
 
Top