Solved

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

Posted on 2012-03-13
5
549 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 35

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 35

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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Find out what you should include to make the best professional email signature for your organization.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

707 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