htaccess rename mp3?

Discussion in 'Apache' started by PunjabiSingh, Aug 21, 2006.

  1. #1
    I have very little htaccess experience, reading the Apache docs even made me more confused, so I'm here for help. I have no clue if this will even work, since I havent found any good tutorial online.

    I'm trying to rename an mp3/avi file on the fly through htaccess:

    real url: http://domain.com/folder/artist 1/album 1/title 1.mp3
    what i want: http://domain.com/folder/artist 1/album 1/title 1 by domain.mp3

    this will ensure that the person that downloads the file is getting a file branded by my domain.

    the php script that sends the user to download file is in http://domain.com/folder/

    I do have htaccess enabled by my host, since i use it for joomla. Also, I welcome any other method that could also "temporarily" rename the file that a user requests.

    thanks in advance
     
    PunjabiSingh, Aug 21, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^folder/artist1/album1/([^.]+)-by-domain\.mp3$ folder/artist1/album1/$1.mp3 [L]
     
    Nintendo, Aug 21, 2006 IP
  3. PunjabiSingh

    PunjabiSingh Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    seeing that huge sticky, i knew you were gonna come thru fast.thanks for the quick response

    looks like i need some regex practice, i had been using (*.) instead of ([^.]+) to do this.
     
    PunjabiSingh, Aug 21, 2006 IP