I have the follow link : www.mysite.com/uploads/file.pdf
I want the user to download the file. But I do not want him vizualize files from this directory. How can I do this?
I'm using PHP and Apache.
I have the follow link : www.mysite.com/uploads/file.pdf
I want the user to download the file. But I do not want him vizualize files from this directory. How can I do this?
I'm using PHP and Apache.
Even better use
Options -Indexes
in your .htaccess filecreate a file named
.htaccess
on that directory and addOptions -Indexes
as the content of the file. Make sure you hit enter after addingOptions -Indexes
This will make sure that your directory will not be index able . i.e you can access the file say
www.mysite.com/uploads/file.pdf
but you cannot list all the files in that directory usingwww.mysite.com/uploads/
Adding an empty file called
index.html
into the directory www.mysite.com/uploads/ will prevent the user from being able to see(visualize) the files.Disabling directory indexes will also work How do I disable directory browsing?