Do you think your website is sluggish? Does it take a lot of time to download on to a user computer? Here are some techniques to make your site load faster on user computers and enhance it’s performance. These are some of the best practices followed in the Web industry. Implementing these practices has proved that your site will become 20-30% faster. This tutorial is for advanced users and I haven’t explained it in detail.
Normally we include multiple Script files in web pages. You can probably write a PHP script which accepts an array of names of all the script files to be included in the webpage which then fetches the content of the files and creates just one file and passes on to the browser. This doesn’t reduce the file size. The combined file size is not less than the sum of the sizes of the individual files. But it reduces the number of HTTP requests sent to your server.
Similarly you can combine all your icon/background images in to a single image and use CSS techniques like “background-position” to show different images at different places. Remember each image causes an HTTP request and you can reduce a lot of requests doing this way.
Use YUI Compressor to minify your Javascrip and CSS files.
You can use Apaches mod_expires module to set Cache-Control header for certain file types. You can configure your apache configuration to add statements like this,
ExpiresByType image/gif “access plus 1 months”
Enable compression using Gzip. 90% of the browsers support this. You can compress your text content, xml, script files etc but not images.
Stylesheets in your header
Make sure that your style sheets are inside the Head tag.
These are some simple things you can implement but will obviously enhance your website performance.