Posts Tagged ‘yslow’

Optimize Wordpress to Score an A with YSlow

Tuesday, March 11th, 2008

I finally took the time to setup Wordpress for myself this week. After I completed the installation (wow, that was fast!), I had the idea to see if I could optimize the delivery of the content. Yahoo! has created a Firefox plugin, YSlow, which reports on several different aspects of a web site’s delivery and structure, and rates each category on an A to F scale.I thought it might be a fun exercise to try to optimize Apache based on the feedback that YSlow provides to see how high a score I could get for this blog. So far, I’m at 93 (an A).

YSlow score for this page

Here are the steps I took in my Apache configuration file.

  1. Enabled g-zip compression for text-html.
  2. Enabled Expires Headers for images in the /images folder.
  3. Turned off etags because I wasn’t using them.

Here are the configuration settings that I added to the .conf file:

<Location />
        # Insert filter
        SetOutputFilter DEFLATE
        # Netscape 4.x has some problems...
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        # Netscape 4.06-4.08 have some more problems
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        # MSIE masquerades as Netscape, but it is fine
        # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
        # the above regex won't work. You can use the following
        # workaround to get the desired effect:
        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
        # Don't compress images
        SetEnvIfNoCase Request_URI \
        \.(?:gif|jpe?g|png)$ no-gzip dont-vary
        # Make sure proxies don't deliver the wrong content
        Header append Vary User-Agent env=!dont-vary
</Location>

<location /blog/wp-content/themes/default/images/>
        ExpiresActive On
        ExpiresDefault "access plus 1 month"
        # Disable etags
        FileETag none
</location>

Let me know if you have any other ideas on improving your YSlow score. Next step: optimize a DotNetNuke site using YSlow.