I have been on Media Temple’s (mt) gs servers for a while. The price is okay, but the performance has been pretty shoddy when using any type of Wordpress install on their shared MySQL plans. Every issue presented to them has been met with a hard sell to upgrade my plan more than doubling the costs of hosting with them.
I have tried all of the tweaks and optimization that I can and I think I have finally gotten it to be somewhat acceptable. Granted there are still days when their system just seems to crumble, but I am resigned at this point until I can find more reliable hosting plans. Naturally, with WordPress restricting your reliance on plugins as well as using the super-cache plugin will speed up your sites but there is even more you can do.
One of the things that has really helped the most, has been working on my .htaccess file. Enabling some of the items key in the yslow panel (gzipping, expires headers, etags, etc.). Some of the actual fixes, although enabled still do not show up in the grading by yslow, but the responsiveness of the site proves to me that these adjustments are working, for the most part. Anyone else, that may be using (mt), might benefit from this example:
### BEGIN gzip # Insert filter AddOutputFilterByType DEFLATE text/html text/plain text/xml ¬ application/xml application/xhtml+xml text/javascript ¬ text/css application/x-javascript # 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 # Don't compress compressed files SetEnvIfNoCase Request_URI \ \.(?:exe|t?gz|zip|bz2|sit|rar)$ \ no-gzip dont-vary # Don't compress PDF SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary ### END gzip ### begin mod_headers caching # 1 YEAR <FilesMatch "\.(ico|pdf|flv)$"> Header set Cache-Control "max-age=29030400, public" </FilesMatch> # 1 WEEK <FilesMatch "\.(jpg|jpeg|png|gif|swf)$"> Header set Cache-Control "max-age=604800, public" </FilesMatch> # 2 DAYS <FilesMatch "\.(xml|txt|css|js)$"> Header set Cache-Control "max-age=172800, proxy-revalidate" </FilesMatch> # 1 MIN <FilesMatch "\.(html|htm|php)$"> Header set Cache-Control "max-age=60, private, proxy-revalidate" </FilesMatch> ### end caching ### begin etag FileETag none ### end etag ### begin expires header <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> ExpiresDefault "access plus 10 years" </FilesMatch> ### end expires header
Some of these I received from friends who were aware of the issues at hand, thanks Kevin, and others I found through lots of searching online. I hope that this may save someone the headache I have been having with (mt) and getting my sites response times to an acceptable and consistent level. If you have any other recommendations, please be sure to forward them on.













Hey there,
Great idea! I think that this method would surely be helpful for sites running on the grid that are either graphic heavy and/or use a lot of AJAX. A site with few graphics and just styled text pulled from a database might see a slight change, but nothing major (my personal problem).
Awesome work though, I will surely use this for a few sites that I run on my grid.
Best,
Ryan
First of all, thank you very much for compiling this. It has made a noticeable impact on my sites’ loading speeds and the sites were already heavily optimized.
Using the latest Yslow all the changes I made using your htaccess were taken into account except one: the Expires header. And the reason for that is a missing line in your code, which should be:
### begin expires header
ExpiresActive On
ExpiresDefault “access plus 10 years”
### end expires header
My comment didn’t get through as planned. My point was that ExpiresActive needs to be On.
Thanks for the additional code. Much appreciated!
I had to add this inside the filesMatch condition to get the expires headers to actually get sent:
ExpiresActive On
I’m on an MT (gs), and used Firebug/YSlow to verify.
Also, I think that the first three cache-control headers are nullified by the expires header at the end. From what I understand, cache-control headers are for dynamic content (so, based on your example: html|htm|php) and expires headers are appropriate for static content (images, styles, scripts.)
Otherwise, this is great. It’s been very helpful for me. Thanks.