I have a website and it has an audio player to play music files. The music files are hosted in a public directory. Since they are there anyome can point there and use the files on their website.

Is there a way to only allow my webpages to use the audio tracks?

  • Please add the OS and the http server you are working on. Fix your title: it is internal access you aim to control.
    – dan
    Commented Jul 23, 2014 at 6:39
  • I am not sure of the OS as I have not made the website go live yet. Most likely it is going to be Apache. Commented Jul 23, 2014 at 11:24

1 Answer 1


The files are public for the users' browsers to be able to play them, so you cannot prevent users downloading them for other reasons (or indeed just saving the copy in their browser cache).

If you want to stop people reusing them in-place from your website (which might be your main aim - someone else referring to the file on your site causes you server load and bandwidth use), you can add a check on the HTTP referrer field. See for instance http://www.htaccess-guide.com/deny-visitors-by-referrer/ .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .