2 Replies - 1156 Views - Last Post: 23 May 2015 - 03:05 PM

#1 laytonsdad   User is offline

  • Let it rip!
  • member icon

Reputation: 466
  • View blog
  • Posts: 1,992
  • Joined: 30-April 10

cache audio files with .htaccess rules

Posted 22 May 2015 - 09:16 PM

Hello folks,

I have a section of my .htaccess file that reads like this:

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/json .js "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType audio/ogg .oga .ogg "access 1 month"
ExpiresByType audio/mpeg .mp1 .mp2 .mp3 .mpg .mpeg "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##



It does good with images, HTML, CSS and the like but it will not cache audio files .mpg and the like.
I think it is because the images are being requested from soundcloud with get information attached like this:

cf-media.sndcdn.com/EqBv9VYsypYl.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vRXFCdjlWWXN5cFlsLjEyOC5tcDMiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE0MzIzNTQ2Njl9fX1dfQ__&Signature=lsA4LEOIBNbkVi068zXdB6Bp1yZx5S47PYpwH23toi037KjO9dtYSf8djnNUH2EdTmW8knN-feJwfrqgGZl5qafSxR50c5C0XOtEPG7K916w2~YlKDWb4nXPKaz07g1EEE44fmNX8qCrwsnAHiE-GBG-OloQh9~mI4M8fxOF1E0ssNpN2rTUUFVxT6TzA9N2wkLDPGRhrQb3HEFsglo8Tz38K66SstGINxXubYXzZc6OGaHsOvAYy4mrAq9TwVe1rR4Vd9odtouk1~HInfn7KqD65QXJQy~R-nN~kewIHRkAhMtopExawo-TnI599OrsIWG0K140R4ozchHKkR-5Dw__&Key-Pair-Id=APKAJAGZ7VMH2PFPW6UQ

Is there a rule or something that will allow me to cache this so when a user comes back to the page and this is requested it has it stored already. It is killing the performance of my audio player for slow connections.

Thanks in advance

Is This A Good Question/Topic? 0
  • +

Replies To: cache audio files with .htaccess rules

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5227
  • View blog
  • Posts: 14,010
  • Joined: 18-April 07

Re: cache audio files with .htaccess rules

Posted 22 May 2015 - 10:32 PM

Well if it is getting the clips from sound cloud then it isn't from your server, so htaccess is not being looked at. htaccess is for assets on YOUR server/domain. The parameters on the end doesn't matter. It looks at the file extension and the mime type.
Was This Post Helpful? 1
  • +
  • -

#3 laytonsdad   User is offline

  • Let it rip!
  • member icon

Reputation: 466
  • View blog
  • Posts: 1,992
  • Joined: 30-April 10

Re: cache audio files with .htaccess rules

Posted 23 May 2015 - 03:05 PM

Thanks Martyr2 I should have known this.

This post has been edited by laytonsdad: 23 May 2015 - 03:06 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1