Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    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!
     
    #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:
    156
    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,366
    Likes Received:
    6
    Trophy Points:
    168
    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:
    151
    Thanks! I'll give it a whirl!
     
  5. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    168
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. desi6n

    desi6n Member

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

    Excellent advice - thanks everyone!
     
  7. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,460
    Likes Received:
    418
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Wouldn't using error pages in cPanel take care of all this?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. mahdionline

    mahdionline Well-Known Member

    Joined:
    Oct 18, 2003
    Messages:
    127
    Likes Received:
    0
    Trophy Points:
    166
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. mahdionline

    mahdionline Well-Known Member

    Joined:
    Oct 18, 2003
    Messages:
    127
    Likes Received:
    0
    Trophy Points:
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    4
    Trophy Points:
    343
    Location:
    ON, Canada
    Are you sure etc/httpd isn't just a symlink to usr/local/apache?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice