Mobile app version of vmapp.org
Login or Join
Harper822

: How to restrict the download of all files in a folder? I have several .pdf files, which should be viewed on my website by clicking a link on a page. But when a pdf file opens, in the address

@Harper822

Posted in: #Download #Links #Pdf

I have several .pdf files, which should be viewed on my website by clicking a link on a page. But when a pdf file opens, in the address bar the directory where all .pdf files reside is visible. So if the user enters example.com/myDir in the address bar he will see and be able to download all files at once. But I don't want that!

When I chmod 644 myDir, the files are not visible even for my site - i.e. you can not open them by clicking the link I have mentioned. How to solve this problem?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Harper822

3 Comments

Sorted by latest first Latest Oldest Best

 

@Kevin317

Using .htaccess you can block it like this:

Options -Indexes


If you want to prevent users from being able to access those files without first being authenticated see this answer.

10% popularity Vote Up Vote Down


 

@Angie530

You should disallow directory browsing. There are a few ways you could to that, depending upon what sort of access you have to the server, but using htaccess is the simplest.

For example, to prevent all PDF files from being listed:

IndexIgnore *.pdf

10% popularity Vote Up Vote Down


 

@Jessie594

Create an empty file named index.html in your myDir folder. Anyone visiting that folder will then see a blank screen instead of a directory listing.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme