Websites today are all about high quality images and streaming media. With large screens becoming more affordable and the increasing resolutions of mobile and tablet devices, designers are going all out to give their pages that wow factor. The result is that modern web pages consist of larger files, which means a lot of data transfer to your visitors before they get to see anything. If you receive a lot of traffic or your target audience don't all have fancy high speed connections, this can be a big problem.
There are plenty of optimisation techniques you can implement, from resizing images and minifying your CSS to implementing a CDN like Amazon CloudFront. There are also two things you can do in seconds, on almost any Apache server, which can noticeably speed up your page load times.
Paste the following code into your .htaccess file for a generic configuration and adjust/extend for your website:
Secondly, you should consider enabling gZip compression using Apache's mod_deflate module. It's a slightly controversial technology and, although it's been around for years, I've only recently started to recommend using it.
The Deflate module compresses all outgoing data using gZip. Web browsers today all have the ability to decompress this data for rendering and, because a web page consists almost entirely of image and text files, which are often very compressible formats, simply enabling gZip compression can hugely decrease the amount of data transferred, which minimises bandwidth requirements. For the best performance you should really compress your images manually and leave gZip to compress only text files.
Paste this in to your .htaccess file to enable text file compression:
The downside of gZip compression is the addition processing required to compress and decompress the data, so depending on who your visitors are likely to be, it may have a negative effect on performance. For example, if one visitor has a top of the range PC but is connecting through an old 56K dial-up line, it makes sense to compress the transferred data and allow their shiny new PC to do the work, but another visitor with a fancy fibre connection might be struggling with old hardware, and expecting that hardware to decompress the data, that you could have sent uncompressed in less than a second, doesn't seem logical.
Today, most desktop users have both solid hardware and high speed Internet connections, so, for really large pages, compression is the obvious choice. Even for small pages, there's a growing trend in mobile browsing where the hardware is often much better than the connection, so, again, compression should be used. Be careful, though, if your website is designed primarily for an audience less likely to keep up with the times.
For more optimisation tips, check out Google's PageSpeed Insights tool.
Blog posts are written by individuals and do not necessarily depict the opinions or beliefs of QWeb Ltd or its current employees. Any information provided here might be biased or subjective, and might become out of date.
Nobody has commented yet.
Your email address is used to notify you of new comments to this thread, and also to pull your Gravatar image. Your name, email address, and message are stored as encrypted text. You won't be added to any mailing list, and your details won't be shared with any third party.