tessguefen
12/4/2015 - 6:42 PM

htaccess Rules / Compression & caching

htaccess Rules / Compression & caching

#Put inside /js/ folder
### Cache for 1 Week
<FilesMatch "\.(js)$">
    Header set Cache-Control "max-age=604800, public, must-revalidate"
</FilesMatch>

#Put in /css/ folder
### Cache for 1 Week
<FilesMatch "\.(css|php)$">
    Header set Cache-Control "max-age=604800, public, must-revalidate"
</FilesMatch>


#For Root
### Caching rules for Images
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 seconds"
    ExpiresByType image/x-icon "access plus 2592000 seconds"
    ExpiresByType image/gif "access plus 2592000 seconds"
    ExpiresByType image/jpeg "access plus 2592000 seconds"
    ExpiresByType image/png "access plus 2592000 seconds"
</IfModule>


#compression
<ifmodule mod_deflate.c>
<FilesMatch ".(js|css|html|htm|php|xml|gif|jpg|jpeg|png)$">
   SetOutputFilter DEFLATE
</FilesMatch>
</ifmodule>