Improve website loading speed

Fast websites on our servers just got faster with GZIP compression.

In the past, older web browsers, some anti-virus software and proxy servers occasionally messed with HTTP compression. We believe the limitation are now largely something of the past. We think so in part because of the increasing value that web designers attach to tools like Google Page Speed, YSlow and others.

GZIP compression

We have now come around and enabled HTTP compression (GZIP compression) on all our Linux web servers. This made possible by the Apache Mod Deflate module. Our new server-wide settings facilitate compression of all website content except for images. Web image formats like JPG, GIF and PNG already include compression; having the server re-compress images will slow down page loads.

Server-side compression is just part of the equation. There are many more things to consider to optimise page load speeds. Too many things to get into here; have a look at Google Page Speed to see what it’s all about. However, one quick and easy thing to do is to enable browsers-side caching: have website visitors’ browsers sensibly cache information and remove the need to load information from the server…

Browser caching

Here is a simple recipe to set up browser caching. At the bottom of the .htaccess file in your public_html directory, paste the following lines of code:

# Browser caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 month"
  ExpiresByType image/jpeg "access 1 month"
  ExpiresByType image/gif "access 1 month"
  ExpiresByType image/png "access 1 month"
  ExpiresByType text/css "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/javascript "access plus 1 month"
  ExpiresByType application/x-javascript "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
  ExpiresByType image/x-icon "access 1 month"
  ExpiresDefault "access 1 week"
</IfModule>

Replace the caching periods with what you deem relevant for your website: update infrequently; increase the caching periods. The above uses the Apache Mod Expires module to insert the necessary HTTP headers into the responses from the server.