Tony M Posted May 28, 2010 Posted May 28, 2010 Do "Heliohost" support enabling Gzip Compression ( http://betterexplained.com/articles/how-to...ip-compression/ ) in .htaccess (can I use Gzip in .htaccess)?
Byron Posted May 28, 2010 Posted May 28, 2010 Ashoat said he would rather not bother with adding the module:http://www.helionet.org/index/index.php?showtopic=5583but you can still use gzip compression by adding this to the top of any php file:CODE<?php ob_start("ob_gzhandler"); ?>
Tony M Posted May 28, 2010 Author Posted May 28, 2010 But you can still use gzip compression by adding this to the top of any php file: <?php ob_start("ob_gzhandler"); ?> Thanks but Do this works 100% ok? I read the post at http://www.helionet.org/index/index.php?showtopic=5583 but I didn't really know what are You meaning in: You should be able to get it working with some other (rather complex) .htaccess directives, though. You would need to (using mod_rewrite) pipe all requests into a single PHP file that would GZIP everything as necessary
Byron Posted May 28, 2010 Posted May 28, 2010 <?php ob_start("ob_gzhandler"); ?> Thanks but Do this works 100% ok? That was one of the options discusssed in that page you posted. I've tried it on a couple of pages of mine and then tested them and they seemed to check ok. Add that piece of code to one of your pages and take it to this test tool: http://www.gidnetwork.com/tools/gzip-test.php I read the post at http://www.helionet.org/index/index.php?showtopic=5583 but I didn't really know what are You meaning in: You should be able to get it working with some other (rather complex) .htaccess directives, though. You would need to (using mod_rewrite) pipe all requests into a single PHP file that would GZIP everything as necessary That was posted by djbob and I really didn't look into doing what he said although I'm sure it can be done. I would just add the code I posted to the top of the page instead. This code came from the page you posted. The only difference is they have it in an if statement checking to see if the browser accepts gzip. <?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>
Tony M Posted May 30, 2010 Author Posted May 30, 2010 I tested the codes: <?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?> and <?php ob_start("ob_gzhandler"); ?> and I tested them with different Gzip compression test tools and ALL WORKED But where to put the code <?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?> in My pages, because every website tells different places. All My pages codes are like <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My test page</title> </head> <body background="images/f.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> .................................................................................................... ............................................... .................................................................................................... ............................................... .................................................................................................... ............................................... </body> </html> so where to put the code (the Gzip code) in My pages?
Byron Posted May 30, 2010 Posted May 30, 2010 so where to put the code (the Gzip code) in My pages? ALWAYS put it at the top of your page right before the doctype (below). <?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My test page</title> </head> You'll never see that php code in the source of the page. Just a space before the doctype. And I guess you already know that the page has to have a .php extension.
Tony M Posted May 31, 2010 Author Posted May 31, 2010 Can I use <?php include("mypage.php"); ?> on every top of My pages and put in mypage.php the Gzip code, so that when I want to disable Gzip on all My pages, I only modify one page (I tested it and worked but I do not know if using php include for the Gzip code can make ERRORS or server errors....)
Byron Posted May 31, 2010 Posted May 31, 2010 As long as you don't remove mypage.php. If the include() function can't find a page it will generate an error. So if you want to disable gzip you would need to comment out the gzip code on mypage.php like this: <?php /* if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); */ ?>
Alcorn Posted August 12, 2010 Posted August 12, 2010 Is mod_gzip available? Mono gzip: 1. GZipStream() Error - gzip 2. Mono.Http.GZipWriteFilter (Mono.Http.dll) doesn't work - modules
Byron Posted August 12, 2010 Posted August 12, 2010 Is mod_gzip available? No it's not available. See my first reply in this thread.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now