Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RahulSaini91/998ac7751d4eff425dec09c34947a59a to your computer and use it in GitHub Desktop.
Save RahulSaini91/998ac7751d4eff425dec09c34947a59a to your computer and use it in GitHub Desktop.
Increase the speed of your website by adding apache cache control into your server's htaccess file
RewriteEngine on
## PLEASE VISIT HERE FOR FULL TUTORIAL / DETAILS OF APACHE htaccess CACHE CONTROL ##
## http://www.rahulsaini.co.in/blogs ##
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
## SET Caching for Images ##
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
## SET Caching for CSS ##
ExpiresByType text/css "access 1 month"
## SET Caching for PDF file ##
ExpiresByType application/pdf "access 1 month"
## SET Caching for JavaScript file ##
ExpiresByType text/x-javascript "access 1 month"
## SET Caching for Flash Files ##
ExpiresByType application/x-shockwave-flash "access 1 month"
## SET Caching for Favicon ##
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment