Created
December 27, 2013 05:34
-
-
Save zeropointdevelopment/8142960 to your computer and use it in GitHub Desktop.
[WordPress] Code from our blog post Speed Up Your Website using Caching and .htaccess - http://www.limecanvas.com/speed-up-your-website-using-caching-and-htaccess/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ifModule mod_expires.c> | |
ExpiresActive On | |
ExpiresDefault A300 | |
# Expires after 1 month | |
ExpiresByType image/gif A2592000 | |
ExpiresByType image/png A2592000 | |
ExpiresByType image/jpg A2592000 | |
ExpiresByType image/x-icon A2592000 | |
ExpiresByType application/pdf A2592000 | |
ExpiresByType application/x-javascript A2592000 | |
ExpiresByType text/plain A2592000 | |
# Expires after 1 day | |
ExpiresByType text/css A86400 | |
</ifModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ifModule mod_headers.c> | |
ExpiresActive On | |
# Expires after 1 month | |
<filesMatch ".(gif|png|jpg|jpeg|ico|pdf|js|htm|html|txt)$"> | |
Header set Cache-Control "max-age=2592000" | |
</filesMatch> | |
# Expires after 1 day | |
<filesMatch ".(css)$"> | |
Header set Cache-Control "max-age=86400" | |
</filesMatch> | |
</ifModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ifModule mod_headers.c> | |
# Turn on Expires and set default expires to 3 days | |
ExpiresActive On | |
ExpiresDefault A259200 | |
# Set up caching on media files for 1 month | |
<filesMatch ".(ico|gif|jpg|jpeg|png|flv|pdf|swf|mov|mp3|wmv|ppt)$"> | |
ExpiresDefault A2419200 | |
Header append Cache-Control "public" | |
</filesMatch> | |
# Set up 2 Hour caching on commonly updated files | |
<filesMatch ".(xml|txt|html|js|css)$"> | |
ExpiresDefault A7200 | |
Header append Cache-Control "private, must-revalidate" | |
</filesMatch> | |
# Force no caching for dynamic files | |
<filesMatch ".(php|cgi|pl|htm)$"> | |
ExpiresDefault A0 | |
Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0" | |
Header set Pragma "no-cache" | |
</filesMatch> | |
</ifModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment