The gZIP compression of your files improves the performance of your website and highly decreases its loading time.
Some applications have internal support to compress their pages. For example, in Joomla you can turn on the Gzip compression from Global Configuration > Server > Gzip Page Compression set to Yes.
You can test whether the compression is working by using this useful tool -http://www.gidnetwork.com/tools/gzip-test.php
If you are not using a web application that has internal methods for enabling the compression, you can enable it directly from your cPanel > Optimize Website.
Alternatively, you can add the following lines to your .htaccess file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
<IfModule mod_setenvif.c>
# Netscape 4.x has some problems...
BrowserMatch^Mozilla/4gzip-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
</IfModule>
<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>
|
Basically, the user makes a request for your website, the server compresses your page (this significantly reduces its size) and transfers it to the customer's computer. On the visitor's end the file is being decompressed and visualized. The time needed for file compression is much less than the time to transfer a big file over the Internet.