Return to Snippet

Revision: 4393
at December 10, 2007 03:32 by heinz1959


Updated Code
# Cache Control with .htaccess
# from http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html

# 3 Month
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$">
	Header set Cache-Control "max-age=7257600"
</FilesMatch>

# 1 Week
<FilesMatch ".(js|css|pdf|txt)$">
	Header set Cache-Control "max-age=604800"
</FilesMatch>

# 10 Minutes
<FilesMatch ".(html|htm)$">
	Header set Cache-Control "max-age=600"
</FilesMatch>

# NONE
<FilesMatch ".(pl|php|cgi|spl)$">
	Header unset Cache-Control
	Header unset Expires
	Header unset Last-Modified
	FileETag None
	Header unset Pragma
</FilesMatch>

# TIME CHEAT SHEET
#      300   5 MIN
#      600  10 MIN
#      900  15 MIN
#     1800  30 MIN
#     2700  45 MIN
#
#     3600   1 HR
#     7200   2 HR
#    10800   3 HR
#    14400   4 HR
#    18000   5 HR
#    36000  10 HR
#    39600  11 HR
#    43200  12 HR
#    46800  13 HR
#    50400  14 HR
#    54000  15 HR
#    86400  24 HR
#
#    86400   1 DAY
#   172800   2 DAY
#   259200   3 DAY
#   345600   4 DAY
#   432000   5 DAY
#   518400   6 DAY
#   604800   7 DAY
#
#   604800   1 WEEK
#  1209600   2 WEEK
#  1814400   3 WEEK
#  2419200   4 WEEK
#
#  2419200   1 MONTH (FEBRUARY)
#  2505600   1 MONTH (FEBRUARY LEAP YEAR)
#  2592000   1 MONTH (APRIL, JUNE, SEPTEMBER, NOVEMBER)
#  2678400   1 MONTH (JANUARY, MARCH, MAY, JULY, AUGUST, OCTOBER, DECEMBER)
# 31536000  12 MONTH

Revision: 4392
at December 5, 2007 03:44 by heinz1959


Initial Code
# Cache Control with .htaccess
# from http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html

# 3 Month
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$">
	Header set Cache-Control "max-age=7257600"
</FilesMatch>

# 1 Week
<FilesMatch ".(js|css|pdf|txt)$">
	Header set Cache-Control "max-age=604800"
</FilesMatch>

# 10 Minutes
<FilesMatch ".(html|htm)$">
	Header set Cache-Control "max-age=600"
</FilesMatch>

# NONE
<FilesMatch ".(pl|php|cgi|spl)$">
	Header unset Cache-Control
	Header unset Expires
	Header unset Last-Modified
	FileETag None
	Header unset Pragma
</FilesMatch>

# TIME CHEAT SHEET
#      300   5 MIN
#      600  10 MIN
#      900  15 MIN
#     1800  30 MIN
#     2700  45 MIN
#
#     3600   1 HR
#     7200   2 HR
#    10800   3 HR
#    14400   4 HR
#    18000   5 HR
#    36000  10 HR
#    39600  11 HR
#    43200  12 HR
#    46800  13 HR
#    50400  14 HR
#    54000  15 HR
#    86400  24 HR
#
#    86400   1 DAY
#   172800   2 DAY
#   259200   3 DAY
#   345600   4 DAY
#   432000   5 DAY
#   518400   6 DAY
#   604800   7 DAY
#
#   604800   1 WEEK
#  1209600   2 WEEK
#  1814400   3 WEEK
#  2419200   4 WEEK
#
#  2419200   1 MONTH (FEBRUARY)
#  2505600   1 MONTH (FEBRUARY LEAP YEAR)
#  2592000   1 MONTH (APRIL, JUNE, SEPTEMBER, NOVEMBER)
#  2678400   1 MONTH (JANUARY, MARCH, MAY, JULY, AUGUST, OCTOBER, DECEMBER)
# 31536000  12 MONTH

Initial URL

                                

Initial Description

                                

Initial Title
Cache Control with htaccess FILES MATCH

Initial Tags
htaccess, cache

Initial Language
Apache