Skip to content

Instantly share code, notes, and snippets.

@RhythmShahriar
Created October 6, 2013 04:14
Show Gist options
  • Save RhythmShahriar/6849443 to your computer and use it in GitHub Desktop.
Save RhythmShahriar/6849443 to your computer and use it in GitHub Desktop.
# @package Caching Tutorail
# @link http://rhythmshahriar.com
# @author Rhythm <[email protected]>
# @copyright Copyright (c) 2013, Rhythm Shahriar
# 1 YEAR Caching
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK Caching
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 3 HOUR Caching
<FilesMatch "\.(txt|xml|js|css)$">
Header set Cache-Control "max-age=10800"
</FilesMatch>
# NEVER CACHE
<FilesMatch "\.(html|htm|php|cgi|pl)$">
Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
</FilesMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment