Suggested Methods by Google for Speeding Up Your Website

Sticking to this weeks theme of speeding up your website, I thought I would address the most likely source of all our visitors, Google. Google may not be your primary source of visitors, but I’m sure you are getting at least a fair percentage of your traffic from them.

To make sure they are happy with your site, a good start would be to make sure you have taken their recommended steps to ensure your site is optimized for fast loading.

Google’s First Recommended Tip is to Optimize Caching

The first tip Google recommends is to optimize caching. By getting content that is repeatedly seen by the user, caching it on their PC is a great  way to eliminate recurring downloads. Having a user download an image or script repeatedly for every page viewed is a brutal experience for a user with slow access. Even with cable or DSL, seconds saved by caching can very rapidly add up, and improve a users experience.

Another form of caching is where your dynamic content is cached as a static page. This speeds things on on the server side, reducing individual requests to content and your database.

With caching you reduce page file size, and total number of HTTP requests. The result is faster downloads, faster browser rendering, and a win for your users.

How To Cache Your Content

This blog is run by WordPress, and for those of you that use WordPress as well, here is an easy fix. Just search the plugin directory from your dashboard for WP Super Cache. Install it, follow its easy directions, job done.

For those of you not using WordPress (most of you?), a decision needs to be made on what type of content you are going to cache. Do you want to cache the content, database queries, or both. I don’t personally cache database queries. What I like to do is let the database queries run naturally, and when the more complex and repetitive queries kick in, I assign a cron file to periodically complete the query writing a new file every time. The effect is pretty much the same.

In regards to caching content you are again given two more choices. You can decide to cache a page in its entirety, or you can cache parts of it. An example of caching part of a webpage would be to create a unique CSS file, and have all of your pages reference it for style. Another common use for this is when a site uses javascript. Instead of including the script within each page, a better way to go would be to create a file with just the javascript so it can easily be cached, and when you need it on a page, reference it.

Too Complex, Where to Start?

So some of you may be thinking this is just too complicated. It can be kind of a pain, but here is a good little sampler that anyone should be able to handle, assuming your site is on an Apache server. Try setting up your image folder to cache images loaded. If you don’t have this file already in your image folder, you will need to create one called “.htaccess”.

Within the .htaccess file, paste in the following:

<ifmodule mod_expires.c>
ExpiresActive On
ExpiresDefault “access plus 2592000 seconds”
ExpiresByType image/gif “access plus 2592000 seconds”
ExpiresByType image/jpeg “access plus 2592000 seconds”
ExpiresByType image/png “access plus 2592000 seconds”
ExpiresByType text/css “access plus 2592000 seconds”
</ifmodule>

<ifmodule mod_headers.c>
# Cache specified files for 30 days
<filesmatch “\.(ico|flv|jpg|jpeg|png|gif|css|swf)$”>
Header set Cache-Control “max-age=2592000, public”
</filesmatch>
</ifmodule>

I included the CSS line so you can see how I cache that as well. Numbers are set for seconds, and Google suggests 1 month. I have mine set for 30 days. Did it work? Don’t know how to test? Comically, testing it can be a bit of a chore itself. However, if you use Firefox, and have the Firebug plugin, testing it is just a click a way. For more information about testing, and downloading Firebug see my post: Webmaster tools Sites Performance.

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *