We love digital 0330 353 0300
Enabling Gzip compression is commonly suggested by Google and many other sources as being an important step in reducing website load times. For me personally it is a mandatory step in either the website construction or the Search Engine Optimisation process. You can detect whether Gzip compression has been enabled on the server by visiting the following website GidNetwork.
Like image optimisation this is a topic unto itself and does require some coding, fortunately like most code you can copy and paste it without having to understand it!
Gzip compression will compress certain file types; HTML, CSS, and JavaScript. It will not compress images, video or music; this should be compressed using another method or tool. We discuss these in other articles.
You must identify the type of server that you are using to host your website. I use a Firefox plugin called “Server Spy” which you can download from here. Or you can visit Netcraft and enter you website URL into the top left hand search box. Depending on the outcome will dictate what method you need to implement to enable Gzip compression.
If you use a CMS you should check the help and support sections of the provider or contact them to ask whether it is possible as not all Content Management Systems will allow you to do this.
Hopefully you have identified your server as being one of the following:
If your server is not listed above please skip to the next step. I say hopefully you have this server type because I am an advocate of Linux servers for a number of reasons, which I will explore in another article. In short it means that you can use the hassle-free .htaccess file which is great for loads of different tasks, one of which is enabling Gzip compression.
So, first thing’s first, you must check to see if you already have a .htaccess file on your server. You can do this in a number of ways; using FTP access is probably the easiest. The file will sit on the root of the domain, so in the same place as the homepage.
If you did find a .htaccess file then open it in a word editor and copy the below code under the last line in the file, save it and upload it back to the root of the domain.
If there was no .htaccess file present, load a text editor like notepad; do not use a word processor like MS Word as this will format the text. Now copy the below code into it:
# compress the files
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript
# removes some bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
Then save the empty text file as .htaccess – it is important to note that you include the ‘dot’ at the beginning of the file and do not save it as a .txt (see image below):
That is it, Gzip compression is now enabled on your server and this will improve site load times.
If you have identified your hosting server as being a UNIX server please go to the next step. If it is a MS Windows server, you may not be able to enable Gzip compression at all. This will be determined by whether the server is ‘dedicated’ or ‘shared’, the difference is significant.
A dedicated server; is a server that hosts only your website, hence it is dedicated to one task or one website. This type of server will allow Gzip compression to be enabled more easily.
A shared server; will host more than one website, if you pay for your hosting through a 3rd party vendor it will most likely be a shared server. Dedicated servers are more expensive and unless you specifically purchased one or specified it as a requirement, you will likely have a shared server. These servers can have Gzip compression enabled but it will affect every website hosted on it, this will increase server processor load and as a result many hosting companies will not enable it.
In order to do this yourself you will need Administrative access to the server. If you do not then you will need to speak to whoever does have that kind of access and ask them to do it. The steps for this are as follows:
Create Compression Folder
Enable Compression in IIS
Create a Web Service Extension (WSE)
Edit IIS Metabase
If you are using UNIX server you will need to follow the below steps in order to enable Gzip compression:
Obtain Software
The IHS v2.0.42.1 software can be downloaded from the IBM HTTP Server support site. The following URL contains a link to the software for each of the supported Workplace platforms.
Copy software to HTTP Server
o tar –xvf HTTPServer.linux.2042.tar
o This will create a subdirectory called IHS-2.0.42 under the directory containing the tar file.
Install Software
o Select Language of English
o Select Next
o Select I accept the terms of the license agreement
o Select Next
o Enter desired installation directory (default: /opt/IBMIHS)
o Select Next
o Choose setup type of Typical
o Select Next
o Confirm correct features to be installed
o HTTPServer base
o Application Files
o Documentation
o Base Extensions
o Security
o Select Next
o The program will install
o Select Finish to close the installation program
Confirm IHS installation successful
o ./apachectl start