How to block files

Discussion in 'Programming' started by aaron_nimocks, Jan 27, 2008.

  1. #1
    Say I have a text/word/adobe file on my site and I dont want people going directly to that URL and looking at it. Whats the easiest way to block them from reading?

    Can I just do that with CHMOD?
     
    aaron_nimocks, Jan 27, 2008 IP
  2. Dolbz

    Dolbz Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    use .htaccess to password protect the directory they are in.

    Google for it and you'll find many many resources to help you.
     
    Dolbz, Jan 29, 2008 IP
  3. fairuz.ismail

    fairuz.ismail Peon

    Messages:
    232
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if you dont want users to see your files when they enter directly into the directory, just put a blank index.html file into the directory and that will solve the problem. good luck
     
    fairuz.ismail, Jan 29, 2008 IP
  4. aaron_nimocks

    aaron_nimocks Im kind of a big deal Staff

    Messages:
    5,563
    Likes Received:
    627
    Best Answers:
    0
    Trophy Points:
    420
    #4
    That will only work if they do

    site .com/directory/

    but if they enter

    site .com/directory/document.doc

    then they can still access it correct?
     
    aaron_nimocks, Jan 29, 2008 IP
  5. fairuz.ismail

    fairuz.ismail Peon

    Messages:
    232
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes, it's correct..

    another solution, you can use .htaccess ..example if you want to restrict inc files, add this to your .htaccess file

    <files ~="" \.inc$="">
    Order allow,deny
    Deny from all
    </files>

    so you can change it to whatever file format that you like..good luck with it.
     
    fairuz.ismail, Jan 29, 2008 IP