I asked my host if they supports mod_expires or not, they told me that it is supported. I use CakePHP and I tried the following code in webroot/.htaccess
and `app_root/.htaccess but Google's page speed is stile considering there is issue in caching of css, js, png, jpg, etc. it found them 24 hour! as the screenshot shows below
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=31449600, public"
</FilesMatch>
The above code is adopted from this article.
Also I used the following:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 year"
ExpiresByType text/html "access 1 month"
# ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 year"
ExpiresByType text/javascript "access 1 year"
ExpiresByType application/javascript "access 1 year"
# ExpiresByType application/x-shockwave-flash "access 1 month"
# ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 year"
</IfModule>
Also I tried to use both codes with each other but the Google Speed tell me the same. Look at the following screen shot:
I need to know how could I solve this issue?!!
Edit##
Using firebug in Firefox I noticed that only resources in the app/views/themed/slate/webroot
are not be affected with the cache
settings regarded above, but those found directly in app/webroot
,
i.e without, theming are affected well.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…