Answer the question
In order to leave comments, you need to log in
How to use browser cache (Wordpress)?
I check the site on Google pagespeed, and there is one obligatory advice left: Use the browser cache. I added the following code to the htacces file
FileETag MTime Size
<ifmodule mod_expires.c>
<filesmatch "\.(jpg|gif|png|css|js)$">
ExpiresActive on
ExpiresDefault "access plus 1 year"
</filesmatch>
</ifmodule>
Answer the question
In order to leave comments, you need to log in
Everything is correct, but you need to see which files are not cached and add their extensions to filesmatch.
I do not remember if Pagespeed shows a list of such files, but the same GTMetrix will definitely show them.
Edit: and add mod_headers, something like this:
<ifModule mod_headers.c>
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=43200"
</FilesMatch>
<FilesMatch "\.(js|css|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
<FilesMatch "\.(flv|swf|ico|gif|jpg|jpeg|png)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question