Manol Posted June 11, 2013 Posted June 11, 2013 Hello. I'm trying to speed a phone webpage by setting expires headers in the htaccess file like this: ... all processwire htaccess settings .... ################################################################################################# # END PROCESSWIRE HTACCESS DIRECTIVES ################################################################################################# </IfModule> <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 month" ExpiresByType image/jpg "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresByType text/css "access plus 2 months" </IfModule> but when I check my webpage whit YSlow I get the following results ( snapshot in the attached file): Grade E on Add Expires headersThere are 4 static components without a far-future expiration date. (2013/6/11) http://patrimonio24.com/site/templates/css/style.css (2013/6/11) http://patrimonio24.com/site/templates/css/add2home.css (no expires) http://patrimonio24.com/site/templates/js/add2home.js (1981/11/19) http://patrimonio24.com/images/demo_content/metroentrance57.jpg as you can see the .css files have a expire date of today not two months as intended and the forth has 1981 expire date, when is supposed to be 1 month form access (today 2013/6/11). I'm using a 1and dynamic cloud server centos 6. Thanks in advance to everybody!
WillyC Posted June 11, 2013 Posted June 11, 2013 what.i use this is good it does.work top {not buttock}, of htaccess u will.put it . enjoy <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 seconds" ExpiresByType image/x-icon "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType text/javascript "access plus 1 month" ExpiresByType application/octet-stream "access plus 1 month" ExpiresByType application/x-javascript "access plus 1 month" </IfModule> <IfModule mod_headers.c> <FilesMatch "\\.(ico|jpe?g|png|gif|swf|woff)$"> Header set Cache-Control "max-age=31536000, public" </FilesMatch> <FilesMatch "\\.(css)$"> Header set Cache-Control "max-age=2692000, public" </FilesMatch> <FilesMatch "\\.(js)$"> Header set Cache-Control "max-age=2692000, private" </FilesMatch> <FilesMatch "\.(js|css|xml|gz)$"> Header append Vary: Accept-Encoding </FilesMatch> Header unset ETag Header append Cache-Control "public" </IfModule> <IfModule mod_deflate.c> AddOutputFilter DEFLATE js css AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html </IfModule> 12 1
horst Posted June 11, 2013 Posted June 11, 2013 and, if not already done: check if module expire is available, (<IfModule mod_expires.c>) and IfNot it will do nothing.
Manol Posted June 11, 2013 Author Posted June 11, 2013 Hello Willy. Now I get different results form different tools as you can see below: Page speed (http://gtmetrix.com/) -> Leverage browser caching is ok here: YSlow (http://gtmetrix.com/) -> Add expires headers here says: YSlow (chrome plugin) -> Add expires headers, NOT OK Hi Horst <IfModule mod_expires.c> is loaded. Thanks
ryan Posted June 15, 2013 Posted June 15, 2013 I'm wondering if YSlow/Chrome might be incorrect in this case. WillyC's htaccess looks right to me. You might need to clear your Chrome cache and restart it. 1
adrianmak Posted March 4, 2015 Posted March 4, 2015 what.i use this is good it does.work top {not buttock}, of htaccess u will.put it . enjoy <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 seconds" ExpiresByType image/x-icon "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType text/javascript "access plus 1 month" ExpiresByType application/octet-stream "access plus 1 month" ExpiresByType application/x-javascript "access plus 1 month" </IfModule> <IfModule mod_headers.c> <FilesMatch "\\.(ico|jpe?g|png|gif|swf|woff)$"> Header set Cache-Control "max-age=31536000, public" </FilesMatch> <FilesMatch "\\.(css)$"> Header set Cache-Control "max-age=2692000, public" </FilesMatch> <FilesMatch "\\.(js)$"> Header set Cache-Control "max-age=2692000, private" </FilesMatch> <FilesMatch "\.(js|css|xml|gz)$"> Header append Vary: Accept-Encoding </FilesMatch> Header unset ETag Header append Cache-Control "public" </IfModule> <IfModule mod_deflate.c> AddOutputFilter DEFLATE js css AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html </IfModule> I found that the header Expires always is Thu, 19 Nov 1981 08:52:00 GMT
HerTha Posted June 22, 2015 Posted June 22, 2015 I found that the header Expires always is Thu, 19 Nov 1981 08:52:00 GMT Same here (at least for text/html)... This is reported to be the birthday of Sascha Schumann: http://stackoverflow.com/questions/8194481/why-is-expires-1981
Recommended Posts