Alec Sharratt

Enabling Gzip Compression

30th Mar 2011 SEO Blog 7 minutes to read

Koozai > Blog > Enabling Gzip Compression

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.

Step 1: Identify the Server

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.

Step 2: .Htaccess File

Hopefully you have identified your server as being one of the following:

  • Linux
  • Apache
  • Sun Java

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):

save htaccess file

That is it, Gzip compression is now enabled on your server and this will improve site load times.

Step 3: Windows Server

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

  • Create a folder where the compressed file will be cached. You can give it any name or leave the default: “%windir%\IIS Temporary Compressed Files”.
  • Grant write permissions to IUSR_{machinename} for the folder.

Enable Compression in IIS

  • In IIS, right-click on the “Web Sites” node and click “Properties”.
  • Select the “Service” tab.
  • Check “Compress application files”. (we have seen issues where PDFs are compressed and cannot be opened)
  • Check “Compress static files”.
  • Change “Temporary directory” (if you created your own folder).
  • Set the “Maximum temporary directory size” to something that the hard drive can handle (i.e. 1024).
  • Save and close the “Web Site” Properties.


Create a Web Service Extension (WSE)

  • In IIS, select “Web Service Extensions”.
  • Add a new web service extension.
  • Name it “HTTP Compression”.
  • Point it to “c:\windows\system32\inetsrv\gzip.dll”.
  • Check the “Set extension status to Allowed” to enable it.

Edit IIS Metabase

  • In IIS, right-click on the server node (top level) and click “Properties”.
  • Check “Enable Direct Metabase Edit”.
  • In Notepad, open the metabase: C:\Windows\system32\inetsrv\metabase.xml
  • Search for “<IIsCompressionScheme”
  • There will be two of them, one for deflate and one for gzip.
  • In “HcScriptFileExtensions”, add aspx, asmx and any other extension that you need to the list already there. Do this for both deflate and gzip and format the format.
  • Change “HcDynamicCompressionLevel” to 9.  Do this for both deflate and gzip.
  • Restart IIS

Step 4: UNIX Server

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

  • With the Lotus Workplace product family it supports two primary configurations: Remote and local HTTP servers.  The key configuration difference in these two implementation methods involves the need to manually copy the plugin-cfg.xml file for the remote HTTP server.  On a locally installed system this step is not necessary.
  • The HTTP server software will be downloaded in the form of a tar’ed file.  The exact format of this download will vary by platform.
  • Transfer the downloaded file to the desired location via an operating system appropriate method.
  • Once the software has been transferred it needs to be extracted to the file system.
  • On the unix environment this is done with the following command:

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

  • The IHS software installer is a Java based install program and requires a pre-existing Java Virtual Machine to be on the system.
  • To install the software, execute the following from within the IHS-2.0.42 subdirectory:
  • java –jar setup.jar
  • The following outline the installation steps.

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

  • Navigate to the IHS binary directory (default /opt/IBMIHS/bin)
  • Start the IHS server by using the following command:

o   ./apachectl start

  • Hit the host name of the HTTP server with a web browser.  It should display the IBM HTTP Server home page as shown below.

Share this post


What do you think?

Gary Hainsworth

What is Black Hat SEO?

Gary Hainsworth
22nd Sep 2023
SEO Blog
Gary Hainsworth

The Importance of Keywords in SEO

Gary Hainsworth
19th Sep 2023
SEO Blog

Digital Ideas Monthly

Sign up now and get our free monthly email. It’s filled with our favourite pieces of the news from the industry, SEO, PPC, Social Media and more. And, don’t forget - it’s free, so why haven’t you signed up already?

We create cutting edge, award-winning digital marketing campaigns

Digital Marketing Audits

Are you a UK business that needs some expert help to uncover what’s holding your digital marketing back? Let us show you!


Call us on 0330 353 0300, email or fill out our Contact Form.

Map of Hampshire Digital Marketing Agency
Hampshire Digital Marketing Agency
Merlin House 4 Meteor Way Lee-on-the-Solent, PO13 9FU, UK
Map of Lancashire Digital Marketing Agency
Lancashire Digital Marketing Agency
Cotton Court Business Centre Church Street, Preston Lancashire, PR1 3BY, UK
Map of London Digital Marketing Agency
London Digital Marketing Agency
Albert House 256 - 260 Old Street London, EC1V 9DD, UK

Unlike 08 numbers, 03 numbers cost the same to call as geographic landline numbers (starting 01 and 02), even from a mobile phone. They are also normally included in your inclusive call minutes. Please note we may record some calls.

Circle Cross