Jump to content

Recommended Posts

Posted

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 headers

There are 4 static components without a far-future expiration date.

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!

post-1191-0-17657100-1370966079_thumb.pn

Posted

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>
 
  • Like 12
  • Thanks 1
Posted

and, if not already done: check if module expire is available, (<IfModule mod_expires.c>) and IfNot it will do nothing.

Posted

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:

post-1191-0-77718700-1370974520_thumb.pn

YSlow  (http://gtmetrix.com/) -> Add expires headers here says:

post-1191-0-27644700-1370974600_thumb.pn

YSlow (chrome plugin) -> Add expires headers, NOT OK

post-1191-0-84697800-1370974713_thumb.pn

Hi Horst <IfModule mod_expires.c> is loaded.

Thanks

Posted

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. 

  • Like 1
  • 3 weeks later...
  • 1 year later...
Posted

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

  • 3 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...