A fast site does a lot for your business. At the minimum, it conserves bandwidth for mobile users on limited-bandwidth contracts and it keeps surfers of all breeds from getting distracted and clicking away while your page loads. All of your clients’ clients deserve a fast web experience — here’s how to give it to them.
Utilize Browser Caching
It might not help on the first load, but browser caching sure helps each additional time that a website has to load a particular graphic, video, or other element. By setting the ‘expires’ header for a long time off — a year is common — you can reduce bandwidth use and load times. If your surfer clicks through multiple pages of the same site, any elements common to those pages will load from the cache as well.
Ask Your Site’s Host to Enable Keep-Alive
Keep-Alive is a simple TCP signal that essentially tells a web server ‘this connection is still active even though it’s not being accessed at this very moment.’ It’s enabled at the host level, but most hosts don’t have it active for 100% of requests. If it is, the latency for subsequent requests is reduced because the request has a pre-established connection to use and doesn’t have to create a new TCP connection for every request.
Enable GZip compression
Almost all modern browsers use GZip these days — essentially what that means is that the server sends the browser a zipped version of the website, and the server unpacks it before it displays it. That further reduces both bandwidth use and load times. Enabling it is a matter of adding a couple dozen lines to your .htaccess code, so the only reason to not use it is ignorance.
Cache Landing Page Redirects for Mobile Users
Since mobile users are more concerned with load times and bandwidth usage than desktop users, it’s only common courtesy to cache redirects to your mobile pages. That way, every time past the first that they load your page, the redirect to you mobile version will be instant rather than delayed. A 302 redirect with a lifetime of 1-7 days that uses a Vary:User-Agent and a Cache-Control: Private is perfect for this job.
That Said: Minimize Redirects In General
This is kind of an obvious one: every redirect in between one website and another causes a delay on the user’s end. This is particularly obvious when you start looking at affiliate websites and the multiple redirects they often go through. In general, you want to use only those redirects that are technically necessary.
Don’t Use Query Strings Unless It’s Actually Dynamic Content
You cannot cache a link with a question mark (the indicator of a query string) in its URL. That means that if your goal is to reduce load times by caching as much as is reasonable, reducing the number of unnecessary query strings to zero is a good practice.
Write Your Character set In HTTP
Many websites don’t bother writing in a character set at all — but if you do, you can speed up the render time on your browser (which, from a surfer’s perspective, is part of load time, after all.) You can specify a character set in PHP or HTTP, but HTTP request sizes are smaller than PHP request sizes and it’s about the same amount of effort either way, so stick with HTTP character sets specifications.
Avoid Broken Links
Whether it’s to someone else’s webpage that went offline or to an image that you changed the name of on you own server, every broken link results in a significant load-time lag as the browser waits for the element’s server to come back with a “does not exist” reply. Use a broken-link checker (there are several good free ones online) on all of your pages on a monthly basis to make sure this isn’t happening to you.
This isn’t by any means a complete list of things that you can do to optimize load times — but it’s an excellent starting place for web designers to use as a baseline. Following these practices and keeping load times down should be the norm for any business site you create.