Apache .htaccess cache settings

             

RewriteEngine On
RewriteBase /

RewriteCond %{ENV:HTTPS} !^.*on
RewriteRule ^(.*)$ https://yourdomain.com/$1 [R,L]

# One year for image files
<filesMatch ".(jpg|jpeg|png|gif|ico)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
# One month for css and js
<filesMatch ".(css|js)$">
Header set Cache-Control "max-age=2628000, public"
</filesMatch>
# 480 weeks
<filesMatch "\.(eot|svg|ttf|woff|woff2)$">
Header set Cache-Control "max-age=1209600, public"
</filesMatch>

comments powered by Disqus