On a php web page, i’m displaying an html5 player which plays an mp3 track, and there’s a download button next to that. I want to mask the download link only, so visitors will not be able to see the directory tree of my server (www.example.com/content/plugins/audio/downloads/test.mp3). I want to change the link to something more simple and smaller like (www.example.com/download/test.mp3) without changing the folders structure of my server.
I’m not sure if it is an .htaccess or PHP thing.
Thanks in advance.
With
.htaccessyou would need the following rewrite rule:It will match all
http://yourdomain.com/download/….mp3requests and redirect tohttp://yourdomain.com/content/plugins/audio/downloads/….mp3If you want your .htaccess to work from inside a subdirectory, use
RewriteBase:i.e.
http://yourdomain.com/subdirectory/download/….mp3tohttp://yourdomain.com/subdirectory/content/plugins/audio/downloads/….mp3