0

I am having a problem compressing my website. My host (www.one.com) does not support gzip, so I contacted them regarding any other way to compress my site. First I talked to a supporter that told me that it could not be done, since their server is set up with zlib. So i googled zlib, and there where some tips regarding this problem.

I tried adding:

php_flag zlib.output_compression on
php_value zlib.output_compression_level 5

to my .htaccess file, witch caused the browser to render: "internal server error".

Then I tried talking to them again, and this time I was pointed to this site: http://www.zlib.net/zlib_how.html

The problem is that I have not come across neither zlib nor zpipe.c before. I have tried to google it, and look around different forums, but I do not get it. Can anyone give me some pointers on how to get this to work? How do I implement zpipe.c? I am a complete noob here, so I would appreciate a step by step guide.

My site is writen in .php

2 Answers2

2

This is how i did it and i am using one.com as hosting company.

I added this line into my index file:

 <?php
    ini_set("zlib.output_compression", "On");
    ini_set("zlib.output_compression_level", "-1");
    ?>

This added compression on my whole site :) myvotebooth.com

And then i added this into my .htaccess file

<IfModule mod_deflate.c>
<FilesMatch "\.(js|css|html)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>

By doing this i get a response header:

Web page compressed?    Yes
Compression type?   gzip
Size, Markup (bytes)    11,329
Size, Compressed (bytes)    3,187
Compression %   71.9

I also tried to compress even more -2 -3 -4 -5 but one.com only allow -1

user722083
  • 21
  • 3
0

First I talked to a supporter that told me that it could not be done, since their server is set up with zlib.

It sounds to me like they don't know what they're talking about. What http server are you using? Apache? Whatever it is, it should support pre-compression of your html using either the gzip or "deflate" content encoding. You need to find someone who supports your server that knows that they're talking about.

zlib is a library of compression routines that can compress to either the gzip or "deflate" content encoding.

The reason I keep putting deflate in quotes is that the HTTP standard calls the zlib format "deflate". It is sometimes confused with raw deflate, and is the reason you should always use gzip for http delivery since there is no ambiguity in that case.

Update:

Since you are using Apache, you can probably get this working without the help of your hosting company. You can put Apache directives to mod_deflate your .htaccess file. Here is an example.

Mark Adler
  • 101,978
  • 13
  • 118
  • 158
  • Yes, I am using Apache, thanks for answering. I guess that leaves med with two choices, either change my hosting company or accept the fact that my site is not getting compressed, cause I dont have the time or energi to get into zlib at this point. – Vegar von Vallestad May 06 '12 at 15:14