How to optimize a site

Optimizing a web site for faster load times, reducing coding errors and providing a better experience for users and search engines alike

During the planning phase of a site, many people put too much stuff on their home page, thinking that everything is equally important. However this increases loading times and spoils the user experience. You’ll notice that visitors don’t spend too much time on your site. You’d better do something about it.

Once you’ve got the first version of your site online, it’s time to think about optimizing the design and layout so that it works well for your visitors and search engines alike.

The HTML code and stylesheets of your site should be valid so that it displays correctly on all platforms and in all browsers. You can verify your web code using the online validators available from the World Wide Web Consortium (W3C)

Once your HTML code doesn’t show any errors any more, it’s time to look at the media files and see how these can be optimized.

When I put the new SiteCheck site online, I tested it with free optimization tool to see if I could reduce the size of the pages so that they load more quickly.

A home page should be less than 100 Kb and even better under 50 Kb. Before optimization, this home page was 130 KB, afterwards it was 33 Kb. I removed unnecessary styles, combined and optimized images and enabled compression on the server to deliver content faster to the end user. The site now loads in under 9 seconds on a slow 56k modem connection.

Enabling compression of your content is quite easy on Apache servers. You just have to enable the deflate module with its standard configuration and add following line to your Apache settings:

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

If you site uses PHP, then adding ob_start("ob_gzhandler") to the start of your pages will do the trick as well.

Another service shows additional improvements which can be achieved by using cache control on your server. This should be quite easy to activate.

Cache control can be enabled in your .htaccess file (if you’re running Apache as your web server)

The following code, when put into a .htaccess file or into the httpd.conf will tell the web browser to store images, stylesheets and javascripts for 7 days in the local cache. This reduces the number of connections to your web server required and gives your visitors a better user experience:

ExpiresActive On
ExpiresByType image/gif "access plus 7 days"
ExpiresByType image/jpg "access plus 7 days"
ExpiresByType image/png "access plus 7 days"
ExpiresByType image/vnd.microsoft.icon "access plus 7 days"
ExpiresByType text/css "access plus 7 days"
ExpiresByType text/javascript "access plus 7 days"
ExpiresByType application/x-javascript "access plus 7 days"

Optimizing Stylesheets and HTML code is a bit trickier because you need to make sure that the optimizers don’t mangle your code and the page still looks like the way you want it.

Here are a few tools that come in quite handy to optimize your codes:

Re-run the W3C Validators again after optimizing the content just to make sure everything is valid code.

If your site doesn’t provide an XML sitemap, then you’re losing out on some features for search engine robots. Those sitemaps are used by search robots/crawlers to find more pages on your site. You can also let them know how often you wish to be indexed and how often your pages change.

Creating an XML sitemap is quite easy. This link provides a free sitemap generator for up to 500 pages. You can then upload the resulting file(s) to your web server.

They also provide an unlimited site map generator for approximately $20. This PHP program is uploaded to your server and you can create your sitemaps as often as you like. It will also submit your sitemaps to search engines for faster indexing. You could even automatically recreate the sitemaps on a regular basis using a cronjob on the server.

Once you’ve created your XML sitemap, you should head over to Google and create a webmaster account to customize your site settings.

You’ll be able to see how often your site is crawled, and set different options to customize how Google indexes your site. You first have to submit your sitemap, though. This process should only take a couple of minutes.

Using the sitemaps, adding keywords to your title tag and through out the site should help people to find your site more easily. Keep in mind that people on slower connections need a lot of patience to load your site unless you reduce the number of kilobytes required to load the site.

Good luck!

Leave a Reply