Menu

Google Site Speed Optimisation

I was just reading Matt Cutts blog and he reminded me about google’s site speed factors – which now (possibly) affecting page rank in search engines. This led me to jump into webmaster tools for my primary site: http://www.simple1300numbers.com.au and check its load time. Its 3.3 seconds – which according to google is in the top 50% of webpages. It also lists some suggestions on what I can do to improve it, mainly some compression to reduce transfer time.

Just a quick disclaimer – backup your site before doing this. I accidently deleted my css and javascript files a few times so just be safe. Also, make sure you correct your paths as needed.

I decided to do what I could to help the load time, so according to my own results in the Net report in firebug, it takes 4.1 seconds to load the front page.

I grabbed Page speed from the link above, here are the results and the points I address from the report:

80/100
1. Leverage browser caching
The following resources are missing a cache expiration. Resources that do not specify an expiration may not be cached by browsers. Specify an expiration at least one month in the future for resources that should be cached, and an expiration in the past for resources that should not be cached:
How to fix this? Enable caching. I use a Plesk 9.2 server, running Apache 2.2 so I found the following addition to my .htaccess

Now the above script creates a few files for us, most importantly css/combined.css.gz and javascript/combined.js.gz. I now update my template for the website to use these files if we in production mode. Also, I run a local file which I adapted for my use: ~/dev/jsmin.php original is here, my custom version is here (rename it). Its the JSMin compressor – with a slight modification (last few lines) to run in cli mode.

You will notice we don’t reference the gzip file directly up there, we do this so that the browser will fall back to the non gzip version if it doesn’t support gzip compression. Now lastly, we need to enable the compression in apache – we do this through our .htaccess