Skip to content

Instantly share code, notes, and snippets.

## OPTION 1 ##
## Shared on http://www.rahulsaini.co.in/blogs ##
## Please try another method if it is not working ##
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
@RahulSaini91
RahulSaini91 / [www.rahulsaini.co.in] - Apache htaccess: Add Cache-Control for Browser Caching
Last active May 24, 2017 16:12
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"