This article describes how to enable data compression using Apache's mod_deflate module. You can use the mod_deflate module to compress output from your web site that is sent to client browsers. Using data compression can reduce page load times and the amount of bandwidth your site uses.
To enable data compression on cPanel-based hosting accounts, follow these steps:
On the Optimize Website page, under Compress Content, select one of the following options:
For unmanaged hosting accounts, you must edit the .htaccess file to enable data compression. The following sample configuration demonstrates one way to enable data compression by specifying file extensions:
<IfModule mod_deflate.c> <filesMatch "\.(js|css|html|php)$"> SetOutputFilter DEFLATE </filesMatch> </IfModule>
In this example, Apache compresses any file that has an extension of .js, .css, .html, or .php.
Alternatively, you can use MIME types to specify which files to compress. The following sample configuration demonstrates one way to do this:
<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css text/javascript application/javascript </IfModule>
In this example, Apache compresses any file that uses one of the MIME types referenced by the AddOutputFilterByType directive.
To disable data compression, you can delete the relevant lines in the .htaccess file, or comment them out by preceding each line with #.
To verify that data compression is active, please see Determining if compression is enabled below.
To check if data compression is enabled on your site, go to https://www.giftofspeed.com/gzip-test, type your domain name in the text box, and then click . The site tells you whether or not compression is currently enabled.
For more information about the mod_deflate module, please visit http://httpd.apache.org/docs/2.4/mod/mod_deflate.html.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
Usamos cookies con el fin de personalizar para usted nuestro sitio Web y analizar el uso de éste. Usted acepta esto haciendo clic en “Acepto” o al continuar usando el sitio Web. Hay más información sobre cookies en nuestra política de privacidad.