Password protect a directory?

Discussion in 'Site & Server Administration' started by driven, Dec 23, 2006.

  1. #1
    I actually know how to go into my cpanel and password protect a directory within my site so that others can't see. However, my images can no longer be displayed if they are used on other sites.

    So how do I make sure that my directories are protected but the images can still show up when I use them on other sites?
     
    driven, Dec 23, 2006 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    Move the images outside of the protected directory and change all your image tags. Right now you have something like siteurl/protected/images. Just move them to siteurl/images.

    Then change your tags from images/filename to siteurl/images/filename.
     
    Colbyt, Dec 23, 2006 IP
  3. driven

    driven Well-Known Member

    Messages:
    400
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    138
    #3
    Assuming I read your directions right, doesn't this just allow people to have access to the redirected url path that you just suggested?
     
    driven, Dec 23, 2006 IP
  4. NeoGen

    NeoGen Writer

    Messages:
    2,303
    Likes Received:
    301
    Best Answers:
    0
    Trophy Points:
    230
    #4
    I am not sure, perhaps you have to make the access of directory as forbidden for listing. That way no can list what is there in the directory, but can view the content/images.. if they are linked to other pages.
     
    NeoGen, Dec 23, 2006 IP
  5. sufi

    sufi Well-Known Member

    Messages:
    2,095
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    105
    #5
    Don't password protect the /images/ directory. Putting a blank index.htm file in the /images/ folder will do.

    You can also use this script in the index.htm page of yourdomain.com/images/ folder to redirect users from /images/ folder to main page.

    Hope this helps :)
     
    sufi, Dec 23, 2006 IP
  6. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #6
    To the images yes.

    A blank index file or any page you want to create and name index.html placed in the images folder will prevent them from browsing the directory.

    You can't use "hot link protection" because you said you wanted to use the images in forums and stuff.
     
    Colbyt, Dec 24, 2006 IP