Results 1 to 3 of 3

Thread: .htaccess: block acess to images folder

  1. #1
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default .htaccess: block acess to images folder

    Quote Originally Posted by djr33 View Post
    You need to give more information.
    You don't need .htaccess to allow anything.
    Generally, it is used to DENY access to certain folders, to redirect users, to set passwords, etc.

    If you are trying to remove something that blocks access (password, protected folder, etc) so that a user can visit a restricted page, then the best idea is to instead fix the original problem because that may create conflicts if you try to "undo" it with a second configuration.

    So, in general, the answer to your question is to create an entirely blank text document, name it .htaccess and place it in the folder. Technically, that's still using .htaccess, but obviously you don't really need to do that. (I mean this seriously-- for example, if you are combining it with an existing .htaccess file, then you will need to know that.)


    can u make it more clear?

    means i want my Image folder not to b browsed by any1,
    show how i can write .htaccess file?
    i want every1 to restrict...?
    or only 1 or 2 users to access it?
    plz define with an example.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That is a completely different question. I have separated your post, and next time post a new thread for a different question.

    The answer is simple, though: .htaccess is designed to restrict access, but it does not work by "users". Instead, look up 'htpasswd', and 'htaccess restrictions' on google.
    You can either block a folder entirely or you can setup a password that only certain people know. You can decide.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    To answer your question - To restrict anyone from listing the contents of your images folder, and only have access to the individual images, you just need to put the following into the .htaccess file:

    Code:
    Options -indexes
    Then just put that file inside your images folder. It will then say something along the lines of "Forbidden", if you try to list the contents of the directory.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •