Let me make my server apply gzip compression to html, php, javascript and css files.

I believe I'm able to get it done by editing the .htaccess file. Can someone produce the precise code which i would need to add?

Also, basically add the right code for an .htaccess file within the parent directory, will it instantly affect all sub-sites too? For example, basically have http://domain1.com pointed inside my root directory and http://domain2.com pointed in a sub-directory, will the 2nd domain provide compressed files without me requiring to edit the .htaccess file for the reason that directory too?


Use mod_deflate

More information here: http://httpd.apache.org/docs/2.2/mod/mod_deflate.html

In the document that Peter Hall recommended on mod_deflate:

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

But that the reply is "yes" concerning the setting propagating lower your directory tree to subdirectories. The very best factor to complete is look into the response headers in the site (using FireBug or similar tool where one can watch the network traffic) and verify the contents are compressed.