# how do i block a file download with .htaccess?



## andrew_u

hi, i would like to play a song on my index page, but not have the url let the link be "downloadable"
right now i have set the permissions on it to '666'
but then i cannot play the file.
can i use .htaccess to allow me to play the mp3, without it being able to be downloaded?


----------



## V0lt

To the best of my knowledge, if it can be played or embedded, it can be downloaded.


----------



## Skie

I think the closest you could do is use a Flash based player and have it set to now allow the files to be saved. Beyond that, I'm not aware of anything that .htaccess can do to limit downloading. When a file is "streamed" it's essentially downloaded. The server doesn't know the difference between streaming and right click->save as.


----------



## andrew_u

hmm. could i encrypt the file name aswell?


----------



## Skie

You'll probably stop 95% of the people, but it's that other 5% that know what they're doing and will get the file no matter what. The only way to truely stop someone is to not provide the files for public access. Even DRM will only work for so long.


----------



## andrew_u

alrighty then.


----------



## royax

You can only block the IP address from a certain range of country where they access your site. You can add this on your .htaccess file

<Limit GET HEAD POST>
order allow,deny
deny from 192.168.1.1
allow from all
</LIMIT

A usefull code Generator is http://thinkhost.com/services/generators/htblock.shtml


----------

