PDA

View Full Version : How do I protect a directory?



masaus
03-16-2008, 11:57 PM
Please allow me to ask you a newbie's question.

I have an issue to protect a directory.

I made a directory which has a couple of pdf files, A.pdf, B.pdf and C.pdf. When I go to http://mydomain.com/directory, I don't want to see all the pdf files in the directory, like "Index of /directory".

But I would like to open A.pdf, B.pdf or C.pdf by clicking http://mydomain.com/A.pdf or B.pdf or C.pdf.

How do I do it? I don't want to use "password protect directories". I just want to do "access denied" when someone accesses the directory.

I barely remember, before Bluehost changed the cPanel, I could do that from the menu.:confused:

Thank you very much for your help.

Basil
03-17-2008, 03:00 PM
.htaccess in public_html

Options -Indexes

antonth
03-18-2008, 02:00 PM
thank you very much for this help needed this bad

masaus
03-19-2008, 11:19 PM
Basil,

Thank you for the information. But I'm wondering what I should do in .htaccess in public_html.:confused: Should I write "Options -Indexes" in it?

Thank you again for your help.
masaus

felgall
03-20-2008, 02:21 AM
If you have a home page (eg. index.html) set up in a given directory then you don't need to block the index because that page will be displayed instead of the index.

micheall
03-20-2008, 06:24 AM
Yes, you could just create a blank text file called index.html, that way you don't turn off indexing for other directories etc that you might need access to. That's the simple method.

Basil
03-20-2008, 06:43 AM
Masaus, yes. You would put "options -indexes" into a .htaccess file under the public_html directory.

masaus
03-20-2008, 09:16 PM
Thank you all for your help.

I solved my problem.

masaus:o