Currently no expires headers in my htaccess file. Before I add the expires headers to the file, I want to make sure this won’t conflict with your plugin settings.
Please advise what settings may need to be changed after adding expires headers.
1. Cloudflare browser Cache is set to respect existing headers.
2. I have Super Page Cache for Cloudflare plugin and have following settings (defaults).
Cloudflare Cache-Control max-age set to 31536000
Browser Cache-Control max-age is set to 60
Automatically purge the Cloudflare’s cache when something changes on the website.
Thank you!
]]>I analyzed the performance of my website and came across this topic: ‘Add Expires headers’.
It sounds like it might be done with setting the cache lifespan, but I am not sure. The topic seems to be related to single files.
In another analyzer, there’s a similar topic (I guess it’s the same), named ‘Serve static assets with an efficient cache policy’. 26 files are listed there.
However, as I am not so deep in the technical basics, I don’t have a clue what to change to improve that. I appreciate any advice. Thank you in advance!
Katrin
]]>location ~* \.(jpg|jpeg|gif|png|svg)$ {
expires 365d;
}
location ~* \.(pdf|css|html|js|swf)$ {
expires 2d;
}
Edit: I tried with the plugin Hummingbird but it says the cache types don’t meet the recommended period type and it won’t get activated.
]]>Enabled Browser Cache;
For “Media and Other files” Enabled Set Last-Modified Header, Set expires header, Set Cache control header, Set entity tag (ETag), and Enabled HTTP (gzip) compression.
Enabled and configured CDN (Test passed) with SSL
Purged all caches using W3 and Amazon CloudFront (Reset Cache)
Issue is cannot get the images (.jpg, png files) to display CACHE TTL – Expire headers not displaying.
Reviewed .htaccess file and W3 shows unset tags for
<FilesMatch “\.(css|htc|less|js|js2|js3|js4|CSS|HTC|LESS|JS|JS2|JS3|JS4)$”>
FileETag MTime Size
<IfModule mod_headers.c>
Header set Pragma “public”
Header append Cache-Control “public”
Header unset Set-Cookie
</IfModule>
</FilesMatch>
<FilesMatch “\.(html|htm|rtf|rtx|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|TXT|XSD|XSL|XML)$”>
FileETag MTime Size
<IfModule mod_headers.c>
Header set Pragma “public”
Header append Cache-Control “public”
Header unset Last-Modified
</IfModule>
</FilesMatch>
<FilesMatch “\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|webp|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|webm|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|_ttf|wav|wma|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|WEBP|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|WEBM|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|_TTF|WAV|WMA|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW|ZIP)$”>
FileETag MTime Size
<IfModule mod_headers.c>
Header set Pragma “public”
Header append Cache-Control “public”
Header unset Set-Cookie
</IfModule>
</FilesMatch>
<FilesMatch “\.(bmp|class|doc|docx|eot|exe|ico|json|mdb|webm|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|pot|pps|ppt|pptx|svg|svgz|swf|tif|tiff|ttf|ttc|_ttf|wav|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|BMP|CLASS|DOC|DOCX|EOT|EXE|ICO|JSON|MDB|WEBM|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|POT|PPS|PPT|PPTX|SVG|SVGZ|SWF|TIF|TIFF|TTF|TTC|_TTF|WAV|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW)$”>
<IfModule mod_headers.c>
Header unset Last-Modified
</IfModule>
What am I missing for Settings in W3 Total Cache that will allow the images to display “efficient cache policy”
Can provide .htaccess code for # BEGIN W3TC Browser Cache # END W3TC Browser Cache
# BEGIN W3TC CDN # END W3TC CDN
For some reason, browser caching via .htaccess doesn’t work on clients shared hosting. That said, I unchecked serve as static files, and browser caching scores improved – now css and images look like are being served with expire headers properly.
The only thing that’s the problem now, is that .js files that are excluded from being concatenaded/minified from autoptimize( only default value, wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js ), are showing in gtmetrix and pagespeed as well as not being cached. Is there a setting for that?
Thanks.
]]>I have updated .htaccess file with far future expire headers. Still on GTmetrix YSlow is showing that there are 5 static components with far future expiration dates.
Can you someone please check and help me out.
There are 5 static components without a far-future expiration date.
https://fonts.googleapis.com/css?family=Montserrat%3A100%2C200%2C300%2C400%2C500%2C600%2C700%2C800%2C900%2C100i%2C200i%2C300i%2C400i%2C500i%2C600i%2C700i%2C800i%2C900i&subset=latin&ver=5.4.2
https://fonts.googleapis.com/css?family=Rubik%3A100%2C200%2C300%2C400%2C500%2C600%2C700%2C800%2C900%2C100i%2C200i%2C300i%2C400i%2C500i%2C600i%2C700i%2C800i%2C900i&subset=latin&ver=5.4.2
https://fonts.googleapis.com/css?family=Roboto%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic%7CRoboto+Slab%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic%7CMontserrat%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic%7CPoppins%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic%7CSource+Sans+Pro%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic&ver=5.4.2
https://www.hastrix.com/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js
https://www.google-analytics.com/analytics.js
Thank you
Himanshu
I tried to solve this with W3 total cache but the problem persists
Would someone guide me about how I can fix this issue?
Rui
Thanks
All use OceanWP theme, have the same plugins and I’ve even created a blank test page on one of the ‘problem’ websites but when I that through GPS it returns a much lower score.
The ‘bad’ websites are :
https://hypnotherapyinpeterborough.co.uk/blank-test = Mobile 71 Desktop 85.
And
https://www.peterboroughstopsmokingclinic.co.uk = Mobile 71 Desktop 87.
And the ‘good’ one is:
https://www.peterboroughtuition.co.uk/ which gets Mobile 88-90 Desktop 99.
The only reason I can think of is that the ‘bad’ websites were originally built using another theme, Celestial Lite, whereas the ‘good’ one was built in OceanWP & so perhaps there’s some ‘old code’ somewhere that’s causing a problem – but this is just a guess on my behalf.
Any suggestions?
]]>so I’ve browsed the forum, but haven’t found the solution.
I’m going through the list of recommendations in GTmetrix, and I can’t seem to find a solution to the “expires headers” one.
It keeps telling me that “There are 13 static components without a far-future expiration date.” and I get F0 with this position.
I’m not great at it, but it seems some of them are fonts.
How do I take care of that?
my site is:
www.karolinafotyga.com
thank you!
Karolina