AspiringWebDesigner Posted August 12, 2009 Report Posted August 12, 2009 I downloaded the firefox extensions YSlow and I have a few questions about how to implement it's recommendations. #1 GZip. How do I implement GZip into my website? The helps section (http://developer.yahoo.com/performance/rules.html#gzip) makes it look like I only have to add a few lines. #2 YSlow says, "There are 2 static components that are not on CDN." I read the help section, but I still don't understand what CDNs are. Would an example of a cdn be, godaddy.com? #3 YSlow says to add expire headers. "There are 2 static components without a far-future expiration date." Is this important and if so...how would I do this? Thank you, Andre Quote
shelfimage Posted September 4, 2009 Report Posted September 4, 2009 Here's what I use in my htaccess file to help gzip compression, headers, etc. But first, Compression can be enabled on your server within the PHP settings (php.ini) if you are on a shared hosting server, then you *might* be able to create a custom php.ini file for your account - ask your web host what they support and how to change default PHP settings. Example, the php.ini file will need: zlib.output_compression = On zlib.output_compression_level = -1 Example .htaccess rules for compression and expires: # ##### Performance Rules ##### # BrowserMatch ^MSIE [6-9] gzip BrowserMatch ^Mozilla/[5-9] gzip AddOutputFilterByType DEFLATE text/html text/css text/javascript application/x-javascript Header append Vary User-Agent # Expires ExpiresActive On ExpiresDefault A0 # 3 months - media files ExpiresDefault A7257600 Header append Cache-Control "public" Header unset ETag Header unset Last-Modified FileETag None # 1 month - image files ExpiresDefault A1209600 Header append Cache-Control "public" Header unset ETag Header unset Last-Modified FileETag None # 3 days - text based ExpiresDefault A259200 Header append Cache-Control "public, proxy-revalidate" Header unset ETag Header unset Last-Modified FileETag None # 5 minutes - dynamic Header set Cache-Control "max-age=300, private, proxy-revalidate" # Force no caching for scripting ExpiresActive Off Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform" Header set Pragma "no-cache" Header unset Last-Modified CDN - Content Delivery - simply put, large sites will use alternate servers (usually in several locations) to serve media and content for their website. So, not everything is on one server. You can trick Firebug by added the site's domain name you are testing to the CDN hostname setting. See: http://developer.yahoo.com/yslow/faq.html#faq_cdn Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.