开发者

How to get grade A on these Yslow rules?

  • Use a Conten开发者_StackOverflowt Delivery Network (CDN)

  • Compress components with gzip

  • Configure entity tags (ETags)

  • Add Expires headers

If i don't have access to Apache configuration.


Use a Content Delivery Network (CDN)

This involves changing your hosting (for at least some files)

  • Compress components with gzip
  • Configure entity tags (ETags)
  • Add Expires headers

You can either:

  1. Get access to your Apache configuration
  2. Get someone who does have access to it to change it


I find "HOW TO SPEED UP YOUR SITE AND GET A YSLOW GRADE" is useful for me. Hope this help.


If you have grade A on every other YSlow rule then you're doing pretty well already and don't need to worry about those items. By the way, you can create custom rulesets in YSlow that are more tailored to your needs and server setup. So if you can't change any of these things, just remove them from the rules that YSlow uses.

Use a Content Delivery Network (CDN)

You can add your site domain as a CDN in YSlow. The idea of this one is to store static components on different domains to increase "parallelisation" (downloading more files at once). If you are using limited hosting then you could open a separate account and host some files there on a different domain.

Compress components with gzip

You can do this in PHP, using ob_start('ob_gzhandler'); at the very start of your scripts. This is a little more resource intensive so use Apache if possible.

Configure entity tags (ETags)

Remove this from the rule list, it's not necessary in 90% of cases. Yahoo only says to remove them because in the rare situation you have multiple servers in the back-end, the same file might have a different ETag if it comes from a different server. When each file comes from one server then ETags are a good thing and removing them is detrimental.

Add Expires headers

If you have no access to the server then you probably won't be able to change this. Ask your host about it. You may be able to override the server setting in your .htaccess file. You'd need the mod_expires Apache module. This page has some usage examples.


Paste this code bottom of .htaccess file

RewriteEngine On
# BEGIN Mod Header

ExpiresActive On
# Turn on Expires and set default expires to 10 years
# END Mod Header

# BEGIN Cache Control

Header set Expires "Thu, 15 Apr 2012 20:00:00 GMT"
Header unset ETag
FileETag None

#END Cache Control
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜