+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: How to....

  1. #1
    alv4's Avatar
    alv4 is offline x10 Lieutenant alv4 is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Bogotá - Colombia
    Posts
    323

    How to....

    I want to make a directory private...
    for example to access to images.domain.com appear forbidden and not list all the files...
    how i can make this?
    www.habboact.net Mi web Alojada en x10 ;)



  2. #2
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: How to....

    To disable directory listing you can add this to your .htaccess file:
    Options -Indexes
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  3. #3
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: How to....

    Do you want to prevent all access (which is what "private" would mean)? Do you rather want to prevent Apache from making directory listings when there's no default index?

    For the former, remove read and execute permissions from the directory. For the latter, add an Options -Indexes to the .htaccess file in the directory.
    Last edited by misson; 05-10-2009 at 12:30 PM.

  4. #4
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: How to....

    note that if you remove all access to the folder, images will not be displayed if you put them on your site with the <img> tag.
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  5. #5
    OdieusG is offline x10Hosting Member OdieusG is an unknown quantity at this point
    Join Date
    Jan 2009
    Location
    Bangor, Maine
    Posts
    50

    Re: How to....

    In apache, the default for blocking viewing files containing ".hta", which include HTAccess files is this code, which should be able to be formatted for anything you have
    Code:
    <FilesMatch "^\.ht">
        Order allow,deny
        Deny from all
        Satisfy All
    </FilesMatch>
    If you want files that are stored on that domain to be inaccessible from outside sources, not really sure.....maybe the Apache documentation may be able to help you there...
    http://httpd.apache.org/docs/2.2

    This is for the latest Apache release....2.2

  6. #6
    gomarc's Avatar
    gomarc is offline x10 Elder gomarc is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    USA
    Posts
    511

    Re: How to....

    You may also consider password protecting the directory. It’s very easy to do from your CPanel > Security > Password Protect Directories


  7. #7
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: How to....

    If you want some hotlinking protection, use a php script that takes the name of the image and returns the actual image content. It shouldn't be hard. Next put all your files in a non web-accessible location. This way, you can log each access to each file, you can add a security code to check access is approved, you can had a cookie check, or even a basic HTTP_REFERRER check.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  8. #8
    idontkno is offline x10Hosting Member idontkno is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    49

    Re: How to....

    Couldn't you just put a blank index.html file?

  9. #9
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: How to....

    @idontkno
    If you know the name of the file, you could still access it, and alv4 doesn't want the directory to be accessed.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  10. #10
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: How to....

    Quote Originally Posted by xav0989 View Post
    [...] and alv4 doesn't want the directory to be accessed.
    It wasn't entirely clear what exactly the OP wanted, to block all access to the directory (and everything in it), to prevent listing the contents of the directory or something else. So far, everything everyone has posted could be what the OP wanted.

+ Reply to Thread
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers