Optimization – cache control for static theme files

Arun - 17/05/2020 6:20 PM

Add this to .htaccess

ref. – https://wordpress.org/support/topic/serve-static-assets-with-an-efficient-cache-policy/

Plugin – not required though – https://wordpress.org/plugins/http-headers/

 

 

Files 1

htaccess
text
# Cache Control - google page speed - Serve static assets with an efficient cache policy 
<FilesMatch "\.(js|css|jpg|gif|png|pdf|swf|svg|svgz|ico|ttf|ttc|otf|eot|woff|woff2|webp)$">
 <IfModule mod_headers.c>
    ExpiresActive On
    ExpiresDefault  "access plus 1 month"
    Header set Cache-Control "public, immutable, max-age=2628000, s-maxage=2628000"
 </IfModule>
</FilesMatch>