Want To Cache An MP3 File..

Discussion in 'Site & Server Administration' started by Bohra, Jun 25, 2010.

  1. #1
    Hey Guys

    Ok so i have an mp3 file which is streamed occasionally now i want to save the cache directly everytime someone opens the file for streaming once.. so basically once its opened its saved in their cache for a particular amount of time say 1 month

    i know we can do it using .htaccess can anyone help ?
     
    Bohra, Jun 25, 2010 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    If you have mod_headers installed for Apache, you can just do something like this in your .htaccess or .conf file:

    Header set Cache-Control "public, max-age=2592000"
    Code (apache):
     
    digitalpoint, Jun 25, 2010 IP
  3. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #3
    <ifModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A1
    ExpiresByType audio/mpeg A5184000
    </ifModule>

    ExpiresActive On
    ExpiresDefault A1
    # Set up caching on media files for 2 month
    <FilesMatch "\.(ico|mp3)$">
    ExpiresDefault A5184000
    Header append Cache-Control "public"
    </FilesMatch>



    Is this correct ??


    or should i use


    <FilesMatch "\.(ico|pdf|flv|jpe?g|png|gif|js|mp3|swf)$">
    Header set Cache-Control "public,max-age=2592000"
    </FilesMatch>
     
    Last edited: Jun 25, 2010
    Bohra, Jun 25, 2010 IP