Speeding up Websites
As many are learning, Google has announced that one of the factors that will improve your SEO performance and, naturally, your user experience is by speeding up your website. At GlobalSpex, we’ve always been cognizant of this, but more for our customers and their target market than search engines. Using CSS, alt tags, and image compression in our web design for speed, style, and 509 disability compliance might also be helpful for optimization. But, as always, we are always learning.
So, we are taking additional steps to improve our website’s speed and our customers. Google suggests installing their speed tool, Page Speed, to help diagnose and suggest ways to compress the site and speed it up. Below are the areas that Page Speed will review:
- Browser Caching – to help with the browser by instructing it to load previously downloaded resources (images, css, html, etc.) from your local disk rather than over the network.
- CSS compression – Removing CSS from documents, compression external CSS and removing unused.
- JavaScript compression – minimizing and combining javascript code.
- Images – Optimizing and setting dimensions.
So far, I’ve compressed our website’s CSS file by removing spaces and extraneous styles. The next suggestion was to install it in our .htaccess file with the recommended caching code. (My next post will include this code)
As promised in my previous post, I include the code we use to cache our website. (I got this from a Google Group discussion.) Further explanation can be found on Google’s help page: https://code.google.com/speed/page-speed/docs/caching.html.
Most web pages include resources that change infrequently, such as CSS files, image files, JavaScript files, and so on. These resources take time to download over the network, which increases the time it takes to load a web page. HTTP caching allows these resources to be saved, or cached, by a browser or proxy. Once a resource is cached, a browser or proxy can refer to the locally cached copy instead of having to download it again on subsequent visits to the web page. Thus caching is a double win: you reduce round-trip time by eliminating numerous HTTP requests for the required resources, and you substantially reduce the total payload size of the responses. Besides leading to a dramatic reduction in page load time for subsequent user visits, enabling caching can also significantly reduce the bandwidth and hosting costs for your site.
The .htaccess file tells the bots to cache certain files at various times for returning visitors.
ExpiresActive On
ExpiresDefault A0
<FilesMatch “.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$”>
ExpiresDefault A29030400
Header append Cache-Control “public”
</FilesMatch>
<FilesMatch “.(gif|jpg|jpeg|png|swf)$”>
ExpiresDefault A604800
Header append Cache-Control “public”
</FilesMatch>
<FilesMatch “.(xml|txt|html|js|css)$”>
ExpiresDefault A7200
Header append Cache-Control “proxy-revalidate”
</FilesMatch>
<FilesMatch “.(php|cgi|pl|htm)$”>
ExpiresActive Off
Header set Cache-Control “private, no-cache, no-store, proxy-revalidate, no-transform”
Header set Pragma “no-cache”
</FilesMatch>