0
I want all mp3 files residing on my server to have "-xxx" added at the end of the filename when a user downloads them. Example:
file on the server: file.mp3
when user downloads: file-xxx.mp3
I've googled something that is pretty close to what I want:
https://forums.digitalpoint.com/threads/htaccess-rename-mp3.128317/
As I don't want to be limited to any particular folder, and would like to have all .mp3's renamed on the fly, I've tried this:
RewriteEngine on
RewriteBase /
RewriteRule ([^.]+)-by-domain\.mp3$ $1.mp3 [L]
but for some reason I can't get it to work, files don't get renamed.
Any help would be appreciated. Thanks!
RewriteRules don't "rename" files, they edit instead edit the request so the file being served can be found. So, the client won't be accessing
file.mp3
, the client will be accessingfile-xxx.mp3
, and the RewriteRule will simply allow the file namedfile.mp3
to be returned as the requested filename. – NReilingh – 2013-01-31T15:46:16.107