i have some indexed document files ( .doc , .docx and .pdf ) stored in a folder in the website.
when i type the full address of the file ( ex http://www.website.com/folder1/folder2/1.doc ) the visitor or any body who is viewing the website can easily download the file.
are there any way to prevent this. are there any configuration has to be done to the .htaccess file to prevent this from happening.
also if folder2 contains only document file, how can i prevent a listing of the files inside this folder in case apache stoped running.
thank you
You have indexed document files mean, you letting crawlers to fetch your files, but you don't want people typing exact URL and downloading it.
So, here is few examples
Welcome for Googlebot, but when there is no referer, reject it.
(Note:Referer can explicitly disable in web browsers, and there is still many other ways to get the files, instead of typing exact url in browsers.)
To prevent access to some specific files, using htaccess, you can write the following:
inside your .htaccess, that is located in the directory that contains 1.doc.
If you want to prevent access to specific file types in general, you could use:
You can edit the list inside the parenthesis to fit your needs.
For more things you could do with htaccess, see the following: http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
Regarding the "how can i prevent a listing of the files inside this folder in case apache stoped running.", I'm not quite sure what you mean...if apache stops running, noone can access anything!