I have recently found this very interesting code to be added to templates/.htaccess to speed up page loading.
In particular this first part is for sending text files using GZIP to save bandwidth and speed up script and stylesheets loading:
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
This part is maybe more useful, because let's you add EXPIRES for some particular files (JS, CSS, templates images) allowing browsers to keep in cache (if they are not yet doing that) some common files which are rarely changed:
<IfModule mod_expires.c>
# Once per day I think is enough for most cases...
ExpiresActive on
ExpiresByType image/gif "access plus 1 day"
ExpiresByType image/jpeg "access plus 1 day"
ExpiresByType image/jpg "access plus 1 day"
ExpiresByType image/png "access plus 1 day"
ExpiresByType text/plain "access plus 1 day"
#ExpiresByType text/html "access plus 15 minutes"
#ExpiresByType text/tpl "access plus 15 minutes"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 1 day"
ExpiresByType application/x-shockwave-flash "access plus 1 day"
</IfModule>
# Once per day I think is enough for most cases...
ExpiresActive on
ExpiresByType image/gif "access plus 1 day"
ExpiresByType image/jpeg "access plus 1 day"
ExpiresByType image/jpg "access plus 1 day"
ExpiresByType image/png "access plus 1 day"
ExpiresByType text/plain "access plus 1 day"
#ExpiresByType text/html "access plus 15 minutes"
#ExpiresByType text/tpl "access plus 15 minutes"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 1 day"
ExpiresByType application/x-shockwave-flash "access plus 1 day"
</IfModule>
You can add both of these code to templates/.htaccess (just paste below the other code) or use only what you need / like... I personally use both of them here, and I think speed has improved.
Let me know if you have any questions about that.
P.S.: of course these pieces of codes will only work on thse servers with the right APACHE MODULES loaded.