Have you ever read about Gzip compression? It is a wonderful way to speed up your WordPress site. What Gzip does is to compress your website information on the server before sending it to the Internet. That way, your visitors receive less information than what they would usually get if your site was not compressed. The reduction can be between 60 and 90 percent in many cases, and Gzipping a site is considered a standard practice for optimizing a website and is highly recommended by experienced web developer such as WordPressintegration.
Browser: “Hello, I request to see the home page of the site, please”.
Server: “OK, I found the home page information. Does your browser accept Gzipped content?”
Browser: “Yes, it does.”
Server: “Ok, then let me compress the information for you… Ready… I’m sending in the compressed information now.”
Browser: “Receiving… Thank you.”
When the server compresses the information, the size of what it sends reduces, for example, from 1 MB to just 384 KB, saving you bandwidth, and to the viewer, downloading speed. It is always faster to download 384 KB than 1 MB of information, after all. Needless to say, the visitor’s browser uncompresses the information on the fly to show the requested home page in the visitor’s screen, so no information is lost in the process.
Although Gzipping content is considered a standard practice online, there are still millions of sites in which either Gzip has not been implemented, or in which it is implemented just partially. In this article, I want to give you a couple of tips to help your WordPress installation be completely Gzipped so you can reap the benefits.
How to Gzip your WordPress site
The easy way to Gzip your WordPress site is by adding a plug-in to your WordPress installation. WP Super Cache is, by far, among the most popular WordPress plug-ins that help you enable Gzip compression. The downside of using a plug-in, however, is that they usually Gzip compress your website partially, so, let me tell you something: If you are OK with a partial compression, or if you would prefer not to get your hands dirty manipulating some code because you don’t feel comfortable enough to do it, then it is OK. Download the plug-in and enable the compression. It will help you a lot anyway, and a partial compression is always better than no compression.
The not-so-easy way is not that hard either, but it requires some coding. Let’s get into the details.
What you will need to do first is to log in to your server with your favorite FTP client. Look for the .htaccess file and download a copy to your computer. My advice is to make a backup copy before editing it. Ready? Then open the .htaccess file with your favorite text editor. Any will do. It is just a text file, after all.
Now add the following lines to your .htaccess file.
What you should NOT try to compress are files what are already pre-compressed, such as image files. A different procedure is done to compress images and optimize them, but that goes beyond the scope of this article.
Once your new .htaccess file is ready, upload it to your server replacing the previous .htaccess file that was there, and test your site. The results are, fortunately immediate. If your changes were successful you may notice a slight increase of the speed of your site. If it doesn’t work, you will get a 500 error message. If this happens, replace the .htaccess file with your backup copy. It means that mod_deflate is not enabled on your site, and you will need to ask your hosting company what modules are installed for your account, and how you can enable Gzip compression on your site.
Anyway, almost every hosting service in the world allows Gzip compression, so you shouldn’t have problems.
Author Bio:This Post Written By Jorge Aguayo(@tedel). He works in Search Engine Optimization team of InTechCenter web design and software development company now, although his experience in the field started back in 2007.