Log in

View Full Version : .htaccess: block acess to images folder



gurmeet
01-18-2010, 01:50 PM
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.

djr33
01-18-2010, 08:41 PM
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.

Schmoopy
01-18-2010, 09:22 PM
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:


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.