Hosting
Green web hosting packagesTutorials
Beginners guides to SEO & hostingBeginners guide to Web Hosting
Compressing text based content
The html that makes up your pages is essentially text. This is the also the case for CSS and Script files. Text can be compressed very well- it has a large amount of “white space” and a limited character set which make it ideal for compression algorithms. All modern browsers accept compressed data- you’ll have to go back to the days of IE 5 until you run into problems with compression support. Your web server should send all its text in compressed format.
Compression in Apache – Once again, I apologise to anyone not using an Apache web server- you will have to research how to compress your text yourself for other systems. Here’s how to do it in Apache…
Open the .htaccess file that you used in the last section and add the following lines:
<FilesMatch “\.(js|css|html|htm|php|xml|swf|flv|ashx)$”>
SetOutputFilter DEFLATE
</FilesMatch>
It’s as simple as that! All text files will be compressed from now on and the user will never notice the difference (unless they have not upgraded their browser since 1995).
Next section: Positioning HTML references to files
Index of all our tutorials: Wight Hat tutorials