set expire for files in apache

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. # Set far-future expiry for images, css, and js
  2. # Remember that you MUST change the filename whenever you update these items!
  3. <ifmodule mod_expires.c>
  4. <filesmatch "\.(jpg|jpeg|png|gif|js|css)$">
  5. ExpiresActive on
  6. ExpiresDefault "access plus 10 years"
  7. </filesmatch>
  8. <filesmatch "\.(ico)$">
  9. ExpiresActive on
  10. ExpiresDefault "access plus 2 months"
  11. </filesmatch>
  12. </ifmodule>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.