How to prevent direct access to a folder within my server?

Discussion in 'PHP' started by srvijay, Jan 11, 2010.

  1. #1
    Hi all,
    I want to prevent direct access of the images folder of my website ..I'm running wamp server in my local machine and I used this

    <Directory "C:/wamp/www/website/images/">
    Order Deny,Allow
    Deny from all
    </Directory>

    Still I'm able to hit the actual path on my browser and handle the images.. Should I have to do any other apache tuning??

    I'm new to php and I've no idea abt these config files.. Kindly help me do this..

    Thanks in advance!
     
    srvijay, Jan 11, 2010 IP
  2. astkboy2008

    astkboy2008 Peon

    Messages:
    211
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try this

    Prevent Unauthorized Directory Browsing ^

    Prevent unauthorized directory browsing by instructing the server to serve a “xxx Forbidden - Authorization Required” message for any request to view a directory. For example, if your site is missing it’s default index page, everything within the root of your site will be accessible to all visitors. To prevent this, include the following htaccess rule:

    # disable directory browsing
    Options All -Indexes

    Conversely, to enable directory browsing, use the following directive:

    # enable directory browsing
    Options All +Indexes

    Likewise, this rule will prevent the server from listing directory contents:

    # prevent folder listing
    IndexIgnore *

    And, finally, the IndexIgnore directive may be used to prevent the display of select file types:

    # prevent display of select file types
    IndexIgnore *.wmv *.mp4 *.avi *.etc
     
    astkboy2008, Jan 11, 2010 IP
  3. srvijay

    srvijay Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the reply.. I guess, the last statement should do the job..But, where should I include these lines..? within the directory tag?

    Sorry for the blunt question :-/
     
    srvijay, Jan 11, 2010 IP
  4. vanadent

    vanadent Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Just use .htaccess hotlinking protection

    Sory, i can not paste the code here because its containg http.
    So here it is altlab dot com/htaccess_tutorial.html


    Good luck
     
    vanadent, Jan 11, 2010 IP