Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

My website is loading large (~3mb) SVG file with jQuery. It takes quite a while therefore I decided to enable gzip compression. I have a hosting account with Bluehost which supports custom .htaccess files. Here is what I have tried to add to .htaccess file to enable compression without any success (I used Google's Page Speed for testing):

<IfModule mod_php5.c>
    php_value output_buffering "1"
    php_value output_handler ob_gzhandler
</IfModule>

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/xml text/plain text/css text/javascript application/x-javascript
</IfModule>

<IfModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file \.(html?|txt|xml|css|js|php|pl|gif|jpg|jpeg|png|swf)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
share|improve this question
1  
In its present form this question is too localized (see Pro Webmasters FAQ). You need to check the installed Apache modules and contact your host for assistance if the modules you need are not installed or not performing as you expect. –  danlefree Aug 14 '11 at 2:18
    
Sorry I didn't realized that the question can be too specific. I wanted to try to ask this question here because I already know what type of an answer ill get from tech support (they probably will say that modules are not available for me to configure). So I thought maybe some people here came up with workarounds or suggestions they could kindly share. –  Shvetusya Aug 15 '11 at 15:28
    
But I am gonna follow your advise and contact tech support. –  Shvetusya Aug 15 '11 at 15:28
add comment

3 Answers 3

up vote 0 down vote accepted

An update to this question, I recently spoke to BlueHost who told me the following:

The way gzip works is that when certain criteria are reached with the server resources, gzip will be enabled and start compressing the sites as needed. Even with the code in the .htaccess file, that's not actually something that you will be able to configure on the account.

But from my findings "as needed" translated to "never". If you really want to GZIP you content (and deliver it quickly) I suggest you look at using Cloudflare as a CDN. Bluehost are a hosting partner of theirs, so it's trivial to set up.

share|improve this answer
add comment

I use the following in the .htaccess on my bluehost account (as recommended by a friend)

  <Files ~ "^[^\.]+$">
    ForceType application/x-httpd-php
    SetOutputFilter DEFLATE
  </Files>

  <FilesMatch "\.(js|css|html|htm|php|xml)$">
    SetOutputFilter DEFLATE
  </FilesMatch>

  ExpiresActive on
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType text/css "access plus 1 month"
  AddType image/vnd.microsoft.icon .ico
  ExpiresByType image/vnd.microsoft.icon "access plus 3 months"
share|improve this answer
1  
Hey thanks for your answer! Unfortunately it didn't work for me all of my .xml .js and .css files are still sent without any compression (i added your code to my .htaccess file in public_html). I guess mod_deflate is not always available on Bluehost. Im trying to contact them to find out the answer. –  Shvetusya Aug 15 '11 at 15:22
    
bluehostforum.com/… On the second page is a support response that they will not consider enabling it. Am guessing, although an old thread, it is still policy. –  pritaeas Aug 16 '11 at 7:18
add comment

Bluehost doesn't offer compressions for .js or .css files (Compression only works on .html or .php files) so you will not get that to work on one of their boxes, even with php.ini or .htaccess changes.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.