Cache Control with htaccess EXPIRES BY TYPE


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



Copy this code and paste it in your HTML
  1. # Cache Control with .htaccess EXPIRES BY TYPE
  2. # from http://forum.powweb.com/showthread.php?t=62786
  3.  
  4. ### turn on the Expires engine
  5. ExpiresActive On
  6.  
  7. ### expires after a month in the client's cache
  8. ExpiresByType image/gif A2592000
  9. ExpiresByType image/png A2592000
  10. ExpiresByType image/jpg A2592000
  11. ExpiresByType image/x-icon A2592000
  12. ExpiresByType application/pdf A2592000
  13. ExpiresByType application/x-javascript A2592000
  14. ExpiresByType text/plain A2592000
  15.  
  16. ### expires after 4.8 hours
  17. ExpiresByType text/css A17200
  18.  
  19. # Please note that the "A" before the numbers above stands for Access.
  20. # This means that the stopwatch starts when a client accesses the file.
  21. # You can also use "M" for modified.
  22.  
  23. # TIME CHEAT SHEET
  24. # 300 5 MIN
  25. # 600 10 MIN
  26. # 900 15 MIN
  27. # 1800 30 MIN
  28. # 2700 45 MIN
  29. #
  30. # 3600 1 HR
  31. # 7200 2 HR
  32. # 10800 3 HR
  33. # 14400 4 HR
  34. # 18000 5 HR
  35. # 36000 10 HR
  36. # 39600 11 HR
  37. # 43200 12 HR
  38. # 46800 13 HR
  39. # 50400 14 HR
  40. # 54000 15 HR
  41. # 86400 24 HR
  42. #
  43. # 86400 1 DAY
  44. # 172800 2 DAY
  45. # 259200 3 DAY
  46. # 345600 4 DAY
  47. # 432000 5 DAY
  48. # 518400 6 DAY
  49. # 604800 7 DAY
  50. #
  51. # 604800 1 WEEK
  52. # 1209600 2 WEEK
  53. # 1814400 3 WEEK
  54. # 2419200 4 WEEK
  55. #
  56. # 2419200 1 MONTH (FEBRUARY)
  57. # 2505600 1 MONTH (FEBRUARY LEAP YEAR)
  58. # 2592000 1 MONTH (APRIL, JUNE, SEPTEMBER, NOVEMBER)
  59. # 2678400 1 MONTH (JANUARY, MARCH, MAY, JULY, AUGUST, OCTOBER, DECEMBER)
  60. # 31536000 12 MONTH

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.