Solved

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

Posted on 2012-03-13
5
548 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS for <center> 14 47
ow do I browse the internet secretly? 6 95
Anchor Bookmark 6 32
Insert PHP into HTML page. 7 48
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

737 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