Category Archives: Gzip

How to add httpcompression in php using .htaccess

Compression is a simple, effective way to save bandwidth and speed up your site.HTTP compression is a capability that can be built into web servers and web clients to make better use of available bandwidth, and provide faster transmission speeds between both.[1] HTTP data is compressed before it is sent from the server: compliant browsers will announce what methods are supported to the server before downloading the correct format; browsers that do not support compliant compression method will download uncompressed data. The most common compression schemas include gzip and deflate, however a full list of available schemas is maintained by IANA. Additionally, it is known that third parties develop new methods and include them in their products (e.g. the Google SDCH schema implemented in Google Chrome browser and used on certain Google servers). To enable compression in php using deflate, just add the following lines in your htaccess file.

Deflate is quick and works, so I use it; use mod_gzip if that floats your boat. In either case, Apache checks if the browser sent the “Accept-encoding” header and returns the compressed or regular version of the file. However, some older browsers may have trouble (more below) and there are special directives you can add to correct this.

How to use Compression method in to speed up website

Common questions related to performance issues of websites

  1. How to improve website performance ?
  2. How to speed up website ?
  3. How to compress webpages
  4. What are the methods to improve page loading speed
  5. How to optimize webpages

I googled alot to find some good and easy method to speed up my websites, already i have optimised all my css and scripts and ofcourse images. So now i need to compress the webpages. And i come up with this solution. It is very simple. This method uses gzip/deflate encoding to compress the webpages. First, create a global.asax file. Now add the following code into that file.

Now upload the file to root of your website.And you are done. But before doing this ensure that you have optimized your css, js and images also. Only then you can feel the change