How do I prevent contents of folders being viewed?

desi6n

Member
Apr 15, 2004
21
0
151
Hello,

How can I prevent the contents of my image folder (ex. www.mywebsite.com/images) from being displayed? If I type in the address I get a page with the index of images and I would like to prevent that.

I know I can use index manager for each folder but is there anyway to do it for the complete site?

Thanks!
 
Last edited:

Jaime

Active Member
Aug 20, 2003
31
0
156
Palma de Mallorca
Just create a .htaccess file on your directory and add the following line:

Options -Indexes

If you already have that file, add the line to it, and if you have the file AND an 'Options', add '-Indexes' to the line.

Jaime
 

dave9000

Well-Known Member
Apr 7, 2003
890
1
168
arkansas
cPanel Access Level
Root Administrator
For one folder here is another solution add a blank index.html page to the folder that way all they get is a blank page or even further add a redirect to it to take them back to the main home page

Site wide the .htaccess or httpd.conf solution is the best choice
 

mahdionline

Well-Known Member
Oct 18, 2003
127
0
166
sawbuck said:
Server wide use in httpd.conf:

<Directory />
Options All -Indexes
AllowOverride All
</Directory>
I add -Indexes to my /usr/local/apache/conf/httpd.conf file and then restart apache from whm, but the problem donot solved !

what's the problem ?

Regard
 

mahdionline

Well-Known Member
Oct 18, 2003
127
0
166
Hi

I'm confused :

I see , we have two httpd.conf on our server :

usr/local/apache/conf/httpd.conf
and
etc/httpd/conf/httpd.conf

Which one is master file ?
I add -Indexes to my /usr/local/apache/conf/httpd.conf file and then restart apache from whm, but the problem donot solved and still i can the contain of a folder that havnot index page.
Regard