{"id":162,"date":"2011-11-10T11:53:33","date_gmt":"2011-11-10T11:53:33","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=162"},"modified":"2011-11-10T11:54:36","modified_gmt":"2011-11-10T11:54:36","slug":"web-page-compression-enable-gzip-encoding-and-caching","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/web-page-compression-enable-gzip-encoding-and-caching\/","title":{"rendered":"Web Page Compression: Enable gzip Encoding and Caching"},"content":{"rendered":"<p>Website load is one factor Google been considered to rank websites in their search engine. The next tutorial explain a step to improve loading time in your website.\u00a0This step is focusing on gzip encoding and caching, it compress the content from your server to the client browser. The reduced file size is what speeds up loading time.\u00a0We can use one of three ways to enable gzip encoding, php.ini, .htacess and using PHP.<\/p>\n<p>You would want to check if GZip is enabled on your site using an online tool at <a title=\"Gzip Test Tool\" href=\"http:\/\/www.gidnetwork.com\/tools\/gzip-test.php\" target=\"_blank\">GidZip Test<\/a>.\u00a0. If you see &#8220;NO&#8221; for &#8220;Web Page compressed?&#8221;,\u00a0then gzip encoding is NOT enabled for your website<\/p>\n<p>1. We can apply gzip compression on\u00a0Apache level or Server level,\u00a0simply add the following line anywhere: <code>zlib.output_compression = on.\u00a0<\/code><\/p>\n<p>2. If you want to apply gzip compresion on certain directory in your server, put the following in .htaccess file<\/p>\n<pre class=\"brush: bash; title: Code Block; notranslate\" title=\"Code Block\">\r\n&lt;IfModule mod_deflate.c&gt;\r\n AddOutputFilterByType DEFLATE text\/html text\/xml text\/css text\/plain\r\n AddOutputFilterByType DEFLATE image\/svg+xml application\/xhtml+xml application\/xml\r\n AddOutputFilterByType DEFLATE application\/rdf+xml application\/rss+xml application\/atom+xml\r\n AddOutputFilterByType DEFLATE text\/javascript application\/javascript application\/x-javascript\r\n AddOutputFilterByType DEFLATE application\/x-font-ttf application\/x-font-otf\r\n AddOutputFilterByType DEFLATE font\/truetype font\/opentype\r\n&lt;\/IfModule&gt;\r\n<\/pre>\n<p>3. You have WordPress installation. Download your WordPress index.php file from your server root directory. Open it up using your favorite PHP editor. Add\u00a0the following \u00a0line just below \u00a0top <!--?<span class=\"hiddenSpellError\" pre=\"\"-->php:<\/p>\n<pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">ob_start(&quot;ob_gzhandler&quot;);<\/pre>\n<p>This method requires you to\u00a0\u00a0manually add that line again after a WordPress upgrade to enable gzip encoding.\u00a0When upgrading your\u00a0WordPress, the line you added,<\/p>\n<pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">ob_start(&quot;ob_gzhandler&quot;); <\/pre>\n<p><span class=\"Apple-style-span\" style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; white-space: normal;\">will be removed from index.php<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Website load is one factor Google been considered to rank websites in their search engine. The next tutorial explain a step to improve loading time in your website.\u00a0This step is focusing on gzip encoding and caching, it compress the content from your server to the client browser. The reduced file size is what speeds up [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8,13,5],"tags":[9,15,11,49,6],"class_list":["post-162","post","type-post","status-publish","format-standard","hentry","category-centos","category-cpanel","category-wordpress","tag-centos-2","tag-cpanel-2","tag-gzip","tag-htaccess","tag-wordpress-2"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-2C","jetpack-related-posts":[{"id":163,"url":"https:\/\/pixert.com\/blog\/moving-wordpress-blog-from-a-subdomain-to-a-subfolder\/","url_meta":{"origin":162,"position":0},"title":"Moving WordPress blog from a subdomain to a subfolder","author":"Pixel Insert \/ Pixert","date":"November 25, 2011","format":false,"excerpt":"I had this blog and this main site on same domain, pixert.com a year ago. I got high traffic to same domain. I separated the blog from main site after serious problems occurred. I made pixert.com\/blog for blog and pixert.com for main site That's a mistake I should \u00a0not done.\u2026","rel":"","context":"In &quot;cPanel&quot;","block_context":{"text":"cPanel","link":"https:\/\/pixert.com\/blog\/category\/cpanel\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":32,"url":"https:\/\/pixert.com\/blog\/compress-files-with-gzip-and-zip-in-centos\/","url_meta":{"origin":162,"position":1},"title":"Compress files with Gzip and Zip in CentOS","author":"Pixel Insert \/ Pixert","date":"March 7, 2011","format":false,"excerpt":"Gzip Type the following command to compress a file at a shell prompt [bash]gzip filename.ext[\/bash] -> The file will be compressed and saved as filename.ext.gz Type the following command to expand a compressed file [bash]<\/code><code>gunzip filename.ext.gz<\/code><code>[\/bash] -> The filename.ext.gz is deleted and replaced with filename.ext Type the following command to\u2026","rel":"","context":"In &quot;CentOS&quot;","block_context":{"text":"CentOS","link":"https:\/\/pixert.com\/blog\/category\/centos\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/centos.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":424,"url":"https:\/\/pixert.com\/blog\/workaround-failed-import-wordpress\/","url_meta":{"origin":162,"position":2},"title":"Workaround for Failed to Import in WordPress","author":"Pixel Insert \/ Pixert","date":"January 21, 2015","format":false,"excerpt":"WordPress always produces \"failed importing\" and \"invalid post type\" when trying to import a .xml file using the Importer plugin. The .xml file also does not recognize the writer in the file, looks like this 1. Import author: () or create new user with login name: or assign posts to\u2026","rel":"","context":"In &quot;WordPress&quot;","block_context":{"text":"WordPress","link":"https:\/\/pixert.com\/blog\/category\/wordpress\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2015\/01\/fail2import.jpg?fit=466%2C859&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":86,"url":"https:\/\/pixert.com\/blog\/protect-htaccess-file\/","url_meta":{"origin":162,"position":3},"title":"Protect .htaccess file","author":"Pixel Insert \/ Pixert","date":"April 5, 2011","format":false,"excerpt":"When avisitor tries to obtain access to .htaccess file, server automatically generates a 403 forbidden error. However, we can apply an extra layer of security to .htaccess Add the following [text] # Protect the htaccess file <Files .htaccess> Order Allow,Deny Deny from all <\/Files> [\/text] Note: htaccess file permissions is\u2026","rel":"","context":"In &quot;CentOS&quot;","block_context":{"text":"CentOS","link":"https:\/\/pixert.com\/blog\/category\/centos\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/lock-150x150.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":117,"url":"https:\/\/pixert.com\/blog\/hide-the-apache-web-server-version-number\/","url_meta":{"origin":162,"position":4},"title":"Hide the Apache Web Server Version number","author":"Pixel Insert \/ Pixert","date":"June 6, 2011","format":false,"excerpt":"There are two config directives that controls Apache version. The\u00a0ServerSignature directive adds a line containing the Apache HTTP Server server version and the ServerName to any server-generated documents, such as error messages sent back to clients. The\u00a0ServerTokens directive controls whether Server response header field which is sent back to clients\u2026","rel":"","context":"In &quot;CentOS&quot;","block_context":{"text":"CentOS","link":"https:\/\/pixert.com\/blog\/category\/centos\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/feather-small.gif?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":111,"url":"https:\/\/pixert.com\/blog\/how-to-disable-directory-browsing\/","url_meta":{"origin":162,"position":5},"title":"How to disable directory browsing?","author":"Pixel Insert \/ Pixert","date":"June 3, 2011","format":false,"excerpt":"One of the must do on setting a secure Apache webserver is to disable directory browsing. This could prevent the server from showing a listing of the existing files if there's no index in one folder. Disable directory browsing via .htaccess Add in the .htaccess file the following [bash] Options\u2026","rel":"","context":"In &quot;CentOS&quot;","block_context":{"text":"CentOS","link":"https:\/\/pixert.com\/blog\/category\/centos\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/feather-small.gif?resize=350%2C200","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/comments?post=162"}],"version-history":[{"count":0,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/162\/revisions"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}