Tag Info

Hot answers tagged

31

Yes, there is almost no reason I can think of to not use GZIP at all times. It's like getting free bandwidth, and it is universally supported. Always have it on! The only possible downsides are If you are on a shared host with very limited CPU resources, as the compression is done on the server and it does take a tiny bit of server CPU. The server would ...


16

Basically every browser nowadays supports deflate/gzip. This page lists many browsers and version numbers. Here's a summary plus some newer browsers: Netscape 6+ (Netscape 4-5 does, but with some bugs). Internet Explorer 5.5+ (July 2000) and IE 4 if set to HTTP/1.1. Opera 5+ (June 200) Lynx 2.6+ (some time before 1999) Firefox 0.9.5+ (October 2001) Chrome ...


12

Yes. 120KB for HTML alone(!) can be compressed greatly. Together with the CSS and JavaScript files. This will speed up the browsing experience for your users and save you bandwidth on your server. You could implement the compression using your server-side script and cache the compressed files, thus easing the pressure on the CPU on busy servers.


9

By far the easiest method is to use an online tool. GIDZipTest shows you plenty of detail: the original size, compressed size and compression percentage. However, it is possible in Chrome with a bit of effort. (Updated for latest Chrome, Sept 2011.) In the Developer Tools, go to the "Network" tab and reload the page. You will see a list of all the files ...


7

Is it good practice to use gzip or not? Depends upon your webserver's environment. If your server is running low on idle CPU time, adding GZIP deflation could actually slow down the rate at which your server responds to requests. If you're not presently dealing with a CPU bottleneck, however, GZIP deflation is a great idea but only for plain-text ...


7

It is unlikely that the compression level affects the decompression time. The tradeoff is in how much time/memory is spent in compression searching for the smallest way to express the input data — more compression isn't just extra layers of processing on both ends (that would be a good way to make the data larger). Once the data is compressed, decompressing ...


7

Pretty much all of Yahoo's Best Practices can be implemented without even touching the site design in any way. Minimize HTTP requests by combining all CSS into one file and all JS into one file. Use Gzip. Set good Expires headers. These rules could affect the design: Reduce the Number of DOM Elements - worth looking at, you should be able to reduce the ...


7

Gzip is probably the most drastic thing you can do. Making sure all you're css and js files are minimized helps. check that you are not loading js libraries or css that you do not need. Most users will cache these so after the first page it's not all that imprortant. Other than that make sure caching is working properly, like not re-parsing a page for ...


6

Yes, Amazon Cloudfront can now serve GZip'ed / HTML Compressed content to end users fairly easily. This used to be rather hard, but Amazon added this to Cloudfront around November 2010. What you are looking for is called "custom origin". The gist of it is: You set up your own web server, and configure this server to correctly compress content for ...


5

This is absolutely worth doing, even for sites with average to low traffic levels. Although it will reduce your bandwidth (with a slight increase in CPU usage), the real benefit is to your users. Even on broadband you can notice a performance improvement when accessing compressed pages, but your users on slower network speeds and newer smartphones will ...


5

Apache uses deflate which is responsible for compressing the data into gzip formatting and sending it to the client, its important to note that the compress happens as the data is requested and not before. You should familiarize yourself with mod_deflate as well ensure its installed and enabled correctly. Formats such as MP3 are not ideal for gzip since ...


4

Are you definitely testing the same URLs? If you are inputting your domain into one testing tool, then that checks if the home page on your site (ie the HTML) is sent gzipped. But if you open the page in Firefox and run Yslow it will check all linked files as well. Your HTML pages may be gzipped (probably as a result of a CMS) but CSS and JavaScript may not ...


4

You can add it to the existing .htaccess file your Wordpress creates for SE friendly URLs. If you don't have an htaccess file from Wordpress then you can create your own with the GZIP code in it and it won't break Wordpress at all.


4

Why do you want to serve those static assets with a gz extension at all? Despite being the common indicator for ages, file extensions are actually an inferior and inaccurate mechanism to communicate a MIME type in the first place: ideally, web resources should be entirely agnostic to file extensions and only communicate their content by means of appropriate ...


4

As covered here, GitHub Pages is served with Nginx and automatically gzip's content. You can confirm gzip compression for your site by checking the HTTP headers with online tools like this one. Enter the URL to a webpage or resource, and type in gzip under "Accept-Encoding" to indicate that the HTTP client (i.e., the online testing tool in this case) ...


3

Yep. Just add more types: AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/x-font-ttf


3

It seems you're not the only one having such problems, look here and here, there are some suggestions on fixes in these threads - have you ruled these out already? Are you in a multi web server environment? Could one of the servers in the pool have a corrupted copy of the image? Interestingly it's not limited to the background image, and the corruption ...


3

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 ...


3

I put the following in my httpd.conf and it seems to work: # 20100709 added etag code FileETag MTime Size # 20100709 added compression START # Insert filter SetOutputFilter DEFLATE # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] ...


3

You'll want to look into mod_deflate (http://httpd.apache.org/docs/2.2/mod/mod_deflate.html) Depending on the operating system, but on most Linux-based systems you can do the following: edit the configuration file httpd.conf or similar) if you have a VirtualHost container, add this: SetOutputFilter DEFLATE you can also set directory-specific compression: ...


3

Put these lines in your .htaccess and PageSpeed Insights will see your gzip compression: <IfModule mod_deflate.c> <FilesMatch "\.(html|php|txt|xml|js|css)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule> It works for my sites.


3

Check here: http://stackoverflow.com/questions/9249243/how-to-disable-apache-gzip-compression-for-some-media-files-in-htaccess-file It's possible, but looks like it will disable gzip for the whole website. Keep in mind that you are telling PHP not to gzip, but Apache may still be gzipping so this should sort it, but check Apache config. RewriteRule ^(.*)$ ...


2

Install ySlow in Firefox and it will tell you which items are being gzipped.


2

My gut says no. Servers only send gzipped content when they receive the correct Accept-Encoding header from the browser. The header itself is not part of the cookie sent by the browser and so you will not be able to modify it. Servers do this to prevent sending a compressed file to a browser that doesn't support it and thus preventing the page from ...


2

Yes, use gzip to compress the file. You'll save a little of CPU power. gzip -c your_big_json_file > your_big_json_file.gz Then in your Apache configuration enable Multiviews Options MultiViews it does content-negotiation with the browser. Note: change the reference to your json file in the code to use the newly created .gz file!


2

The first thing I noticed when I looked at your page in Firebug is that some of your images (specifically this one, which toomanyairmiles already posted a screenshot of, and this other one) are simply huge — the first one is 4.2 megabytes! When I first loaded the page, the huge image was corrupted, more or less like in toomanyairmiles's screenshot. ...


2

The output of PHP files is HTML. That HTML will be compressed using the code in this question: AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/javascript application/json That's all you need to do (assuming mod_deflate is enabled for Apache).


2

Won't work with IE6 browsers, but here's how WordPress users do it. http://perfectionlabstips.wordpress.com/2008/12/30/serving-gzipped-gz-files-as-compressed-css-javascript-html-content/ Their examples are for CSS and JavaScript, but it's easily applicable for .html from the samples. They show you how to detect for browsers that won't work and keep an ...


2

Quoting @cyberx86 over at ServerFault (who you should go and vote up): The .xml.gz filetype may be defined as being an xml file (e.g. with forcetype in a filesmatch block) - which would cause Apache to match it to the type above. I think you can get around that by adding an exception, above it: SetEnvIfNoCase Request_URI ".xml.gz$" no-gzip ...


2

The easiest way to manage Gzip compression in Apache is to add these lines in your .htaccess file: <IfModule mod_deflate.c> <FilesMatch "\.(html|php|txt|xml|js|css)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule> It works well for my website.



Only top voted, non community-wiki answers of a minimum length are eligible