The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I prevent contents of folders being viewed?

Discussion in 'General Discussion' started by desi6n, Jul 9, 2004.

  1. desi6n

    desi6n Member

    Joined:
    Apr 15, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    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!
     
    #1 desi6n, Jul 9, 2004
    Last edited: Jul 9, 2004
  2. Jaime

    Jaime Active Member

    Joined:
    Aug 20, 2003
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    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
     
  3. sawbuck

    sawbuck Well-Known Member

    Joined:
    Jan 18, 2004
    Messages:
    1,367
    Likes Received:
    5
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Server wide use in httpd.conf:

    <Directory />
    Options All -Indexes
    AllowOverride All
    </Directory>
     
  4. desi6n

    desi6n Member

    Joined:
    Apr 15, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Thanks! I'll give it a whirl!
     
  5. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    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
     
  6. desi6n

    desi6n Member

    Joined:
    Apr 15, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    thanks

    Excellent advice - thanks everyone!
     
  7. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,474
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Wouldn't using error pages in cPanel take care of all this?
     
  8. mahdionline

    mahdionline Well-Known Member

    Joined:
    Oct 18, 2003
    Messages:
    127
    Likes Received:
    0
    Trophy Points:
    16
    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
     
  9. mahdionline

    mahdionline Well-Known Member

    Joined:
    Oct 18, 2003
    Messages:
    127
    Likes Received:
    0
    Trophy Points:
    16
    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
     
  10. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    Are you sure etc/httpd isn't just a symlink to usr/local/apache?
     
Loading...

Share This Page