Solved

website errors - browser caching and Vary: Accept-Encoding header

Posted on 2012-03-13
5
546 Views
Last Modified: 2012-03-14
i have a site i am working on,

i get low scores due to these errors,

Leverage browser caching
and
Specify a Vary: Accept-Encoding header

i looked at there links to google, but have not been able to incorporate it into the site.

thanks for your help.

here is an image and link

http://tools.pingdom.com/fpt/#!/OU1lfq4AL/http://fordag.com

errors
0
Comment
Question by:webdott
  • 2
  • 2
5 Comments
 

Author Comment

by:webdott
ID: 37718204
found this - understand it now:

create a notepad file called:

.htaccess

save this in it:
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType image/bmp "access 1 month"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType text/javascript "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType text/xml "access 1 month"
ExpiresByType text/plain "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##

how do i add this to expire?
http://www.google-analytics.com/ga.js

I tried:
ExpiresByType application/js "access 1 month"

thanks for any help
0
 
LVL 34

Expert Comment

by:gr8gonzo
ID: 37719456
The ga.js is hosted by a different site. Since you are not the owner, you cannot control its caching/expiration.
0
 
LVL 25

Expert Comment

by:kevp75
ID: 37719791
That is not necessarily true gr8gonzo...  you could devise a method to download the js file, and build in a caching mechanism

I do it in .Net
0
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 500 total points
ID: 37720049
@kevp75, if it were a standard JS file that could run locally, I would agree, but typically the JS files from web traffic analysis services like Google Analytics, Omniture, Hitbox, WebTrends, etc... - those NEED to run from the host service. When the browser hits it, the service is notified of that hit. GA may be able to be tinkered with, but it's not the recommended path, nor would it speed up the site at all.

Plus, if Google wants you to cache that file, then by hosting it themselves, they are suppressing a lot of internet traffic overall (if you download it from Site A, then it becomes cached for Site B, C, and D that also use the same file). In fact, webdott could very well be Site B or C or D so it may already be cached by a visitor who has been on a different site that used the analytics JS. By trying to host it himself, he could be adding more unnecessary downloads for his visitor.

Also, most browsers have a limit on how many simultaneous transfers they get from a domain, so by pulling the JS from Google Analytics's domain, you're actually allowing the browser to pull more resources faster (when they don't have it cached). While IE (for example) is pulling 2 resources from webdott's domain, it can also pull the GA resource at the same time. (This is why CDNs can make such a positive impact on performance - it's a divide and conquer strategy).
0
 

Author Closing Comment

by:webdott
ID: 37720212
thanks for explaining it.  it sucks i can't index it to get a score of 100,
but google already does its best to speed the internet.

the site still runs fast. i was just trying to fix all the bugs.

thanks again for your help and detailed info.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now