If this is your first visit, check our documentation. To post, register or login.
Forums / Search Engines / leverage browser cache ( PageSpeed Insights ) and htaccess

leverage browser cache ( PageSpeed Insights ) and htaccess

Started by mesnitu on 6 Oct 2016, 6:40 PM · Views: 97

Results 1 to 4 of 4
6 Oct 2016, 6:40 PM
#1
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

leverage browser cache ( PageSpeed Insights ) and htaccess

Hi

I've been trying to improve the results on PageSpeed Insights ( desktop I have a green light, mobile I manage to get from red to yellow :dontgetit )

There a section ( leverage browser cache ) , that says :

http://s7.addthis.com/js/300/addthis_widget.js (expires not specify)
http://s7.addthis.com/l10n/client.pt.min.json (expires not specify)
http://m.addthisedge.com/…22a0&callback=_ate.track.config_resp (60 seconds)
http://example.net/…t_bookx_info/jscript_textarea_counter.js (60 minutes)
http://example.net/…ludes/templates/tpl_pb/jscript/tpl_pb.js (60 minutes)
http://example.net/…udes/templates/tpl_pb/css/stylesheet.css (2 hours)
http://example.net/…mplates/tpl_pb/css/stylesheet_cookie.css (2 horas)

I've follow a tutorial here on zencart , and more or less I have this in the htaccess file

## Optional caching improvements
## Requires mod_header and mod_deflate to be enabled within Apache
##################
<IfModule mod_headers.c>
  Header unset Pragma
  FileETag None
  Header unset ETag
  <FilesMatch ".*\.(ico|jpe?g|JPE?G|gif|GIF|webp|png|swf|flv)$">
    Header set Cache-control "max-age=864000, public, must-revalidate"
    Header unset Last-Modified
  </FilesMatch>
  <FilesMatch ".*\.(html|htm|xml|txt|xsl)$">
    Header set Cache-control "max-age=7200, must-revalidate"
  </FilesMatch>
</IfModule>
<IfModule mod_deflate.c>
  <FilesMatch "\.(js|css)$">
    SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>

##################
## Optional improvements
## Requires mod_expires to be enabled within Apache
##################
<ifmodule mod_expires.c>
  ExpiresActive On
  ExpiresDefault A300
  ExpiresByType application/x-javascript A3600
  ExpiresByType text/css A3600
  ExpiresByType image/gif A604800
  ExpiresByType video/x-flv A604800
  ExpiresByType application/pdf A604800
  ExpiresByType text/html A300
  ExpiresByType image/x-icon A86400
  ExpiresByType image/jpeg A2592000 
  ExpiresByType image/png A2592000 

</ifmodule>

I dont's understand what else I should do.
His telling that the js as a expire ( 60 minutes ) , and yet keeps saying to leverage the browser cache.... :frusty:

Anyone knows a way to ..... improve, or whatever this stuff ?

Thanks

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

6 Oct 2016, 6:52 PM
#2
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: leverage browser cache ( PageSpeed Insights ) and htaccess

I think it has to do with the fact that the scripts are loaded from an external source. I am dealing with the same issue, and also have not found an answer yet.

6 Oct 2016, 7:04 PM
#3
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

Re: leverage browser cache ( PageSpeed Insights ) and htaccess

Design75:

I think it has to do with the fact that the scripts are loaded from an external source. I am dealing with the same issue, and also have not found an answer yet.

Thanks

Not sure about that Design 75. I've pasted above a products page insight , and the "addthis" code of is only loaded at that page (products page).

But if I check the home page , I still got this result :

http://example.net/…ludes/templates/tpl_pb/jscript/tpl_pb.js (60 minutos)
http://example.net/…udes/templates/tpl_pb/css/stylesheet.css (2 horas)
http://example.net/…mplates/tpl_pb/css/stylesheet_cookie.css (2 horas)

I had the one other cookieconsent js, loaded from a external source, I've change all that to be local, but yet.... I still have this results.....
I've google, and google.... but I don't get it.

His saying this file has 60 minutes to expire, and yet saying to use the browser cache.
Or maybe is set to expire, but not on cache ?

I on a shared host, but I think his reading all the mod_headers.c and module mod_expires.c

“Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

18 May 2018, 3:10 AM
#4
jasonshanks avatar

jasonshanks

Zen Follower

Join Date:
Feb 2009
Location:
atlanta GA
Posts:
297
Plugin Contributions:
0

Re: leverage browser cache ( PageSpeed Insights ) and htaccess

I know this is old , but did you ever get this sorted out ? I can't seem to find any post on the message board with people who actually solved this.

Zencart 1.5.6c PHP 7.2 Order Replacement AC Adapters and Power Cords Online https://www.missingcord.com