0

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.

Mayckon Barbosa
  • 91
  • 1
  • 12
  • Could you elaborate on what you mean by "visualize files"? Maybe [mod_autoindex](http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html)? – complex857 Feb 01 '13 at 16:21

2 Answers2

1

Even better use Options -Indexes in your .htaccess file

create a file named .htaccess on that directory and add Options -Indexes as the content of the file. Make sure you hit enter after adding Options -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 using www.mysite.com/uploads/

prakashchhetri
  • 1,806
  • 4
  • 36
  • 61
0

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?

Community
  • 1
  • 1