Forum Moderators: phranque
now the problem is that my folder that has downloadable files is accessible directly like
www.domain.com/downloads
i want to prevent the HTTP access to this folder so that whenever some user write the direct url to access folder it must not allow him and redirect to main page of the site..
can i do this with .htaccess? if yes, please help me as i really dont know enough about .htaccess files.
thanks in advance
If so, place an .htaccess file in www.domain.com/downloads, and put this in it:
<Files *>
Deny from all
</Files>
That should do it. The directory is now inaccesible using HTTP, and can only be read by scripts on your server.
See Apache mod_access [httpd.apache.org] for more information.
Jim
after loggin in user can see links like
<a href="domain.com/downloads/file.zip">Click here to download</a>
after i pasted a .htaccess file with your told code, it is not allowing to download files even with the above links..
please guide me about this
thanks in advance
If you use a link as you showed, then the download is done as a direct HTTP request to the file. And since the code I posted prevents any access via HTTP, it will be blocked.
I apologize if my post was not sufficiently clear, but as I wrote, the method only works if you use a script to prevent unauthorized access.
Jim