I am currently on a shared host and my files and folders are placed inside “public_html”. In this, I have a folder that consists more folders inside it along with many pdf files. So the folder looks like this:
FOLDER/folder1/xyz.pdf
FOLDER/folder2/abc.pdf
etc..etc..
I am trying to figure out a way to deny access to the folder directly through a browser but not deny access to the files in it. At the moment, when someone goes to my site as http://www.mysite.com/FOLDER, you can access the folder and see its contents through a browser itself. But I dont want to deny complete access to the folder since I have links to its pdf files in some of other pages on my site like: Click here
Can someone guide me on I can restrict the direct access to the folder but not deny access to its files plz?
EDIT:
I am thinking, do I just create an index.html file in every folder?
I would suggest using htaccess and adding the IndexIgnore command:
IndexIgnore *
Put it in a file and call it .htaccess (Not .htacces.txt, only .htaccess)
Another option is to prevent only one kind of file from being indexed:
IndexIgnore *.pdf
You can ignore any file type: ” *.pdf *.zip *.jpg *.png *.html(bad idea! 😛 )”
I hope this helps 🙂