Make your directory Fly: How to GZIP Compress
Posted January 7th, 2009 byCategories: straightguysca.com
how?
You can easily shave off almost half of your bandwidth and download time for your directory using GZIPPING....
most hosts use it if they use PHP....
how to apply this "mod" :D (its the easiest of em all!):
open index.php
before ANY code add this:
ob_start( 'ob_gzhandler' );
?>
You are done!! To get a feel for how much speed you gained and bandwidth check:
http://www.websiteoptimization.com/services/analyze/
Compare before and after....
I gzipped my css file to 1/3 its original size using two things:
1)
http://www.cssdrive.com/index.php/main/csscompressor/
and
2)
then changing the css file type from .css to .php and adding
ob_start ("ob_gzhandler");
header("Content-type: text/css; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
?>
to the top of the php file
Make sure you refer to the php (css) file in the following way:
im done :D my first contribution...if you call it that :P
KNOWN PROBLEMS: may influence MSN rankings? (not sure 100%) - please post here if you know anything about Gzipping and MSN SERPS
Hello [...],
Thank you for writing to Live Search Technical Support. My name is Ma*ric*hu and I understand that you are inquiring about GZip Compression.
your information is accurate and we do not currently support GZip Compression.
We appreciate your continued support as we strive to provide you with the highest quality service available. Thank you for using Live Search.
Sincerely,
Ma*ric*hu
Live Search Technical Support
(i put stars in the name so it doesnt get googled, and removed mine:p)
its better by 60%
The main thing I don't like about gzipping right now is MSN's search engine can't seem to read gzipped pages. Stupid I know, but what else can I say?
are you 100% sure on this one or just using an0n's experience
should i implement it?
php_flag zlib.output_compression On
php_value zlib.output_compression_level 5
But make sure your hoster and webserver allows it, else you'll get a 500/Internal Server Error if it's disabled.
Boby
cool! that is easier
I'm starting to get the dev area setup, and soon we'll start combing the forums for miscellaneous bug fixes and improvements.
Thank you.
I was doing between 4-600 in ypn a month and now i barely hit 100.
grrrrrr
hmm are u serious? **censored****censored****censored****censored**. Msn better wake up this is important to speed up the net. I never thought of SEO implications although I consider myself a pretty good SEOer... sorry for this :(
but anyways, i believe Dawzz uses files to cache with, but i could be wrong....whatever it is he does it has helped a lot on peoples sites...
IF you site is getting slammed and you can follow basic instructions on use I can cahce your site and speed it up to the point you think it is static.
I've found this code but I can't get it to work with phpld
http://www.ilovejackdaniels.com/php/caching-output-in-php/
I've used this type of thing on other projects and it really made a different to the crawlability of the site and response times are just slashed to pieces.
Cheers,
Dave
I'm on dialup and my directory just literally loaded in 2 seconds!
Just create a file called php.ini in your public_html but it would maybe also work in the root folder of your directory.
Add following code to it:
zlib.output_compression = 4KB
I had no time to test it, but I hope it works, I got this from the php.ini reference.
More help maybe here:
http://www.php.net/manual/en/ini.php#ini.list
google does the same thing to me...i have a foamy fan site and it lists all of my flash files :rolleyes:
anyways lol thanks for the .htaccess trick...though it didn't seem to really speed up anything lol
I tested the loading speed with
Summit Media Spider Simulator (http://tools.summitmedia.co.uk/spider/)
my directory went from 2 seconds to 1 second :p but hey every little bit helps *and before ya say anything...yes i just started the directory, however i've got like 250 links to it...yeah yeah not much i guess comparitively :o
it works in other php documents too such as your main pages also...
all the best
i think they may have lied though cuz i have php_flag zlib.output_compression On
php_value zlib.output_compression_level 5 in my .htaccess on my adult directory but yet it's still indexed by msn.
the cool thing is it works for people that have browsers enabled for compression ie 99% of them, the rest the server just serves up the un-compressed copy so need to worry about losing visitors...
:D
You can do it yourself by researching adodb caching or let me do it and you report back anything you run into problem wise. I truely dont think there are any :)
well.. that definately isn't something i wanted to read ;((
hopefully they fix it.
The post right above your tells you exactly what to put in yout .htaccess file.
http://in.php.net/ob_gzhandler
says:All browsers are supported since it's up to the browser to send the correct header saying that it accepts compressed web pages. If a browser doesn't support compressed pages this function returns FALSE.
so ... does msnbot send these headers!, if it does, whats the issue!
M.
the result was great thank you
:)
later
lol at least someone finds my mod still finds it helpful... they actually included it sometime back in phpld 2.x something (paid only i think) in the admin panel.
no offense but yahoo and msn suck at getting my pages no matter if i gzip or not. Google has no problem with gzipping whatsoever. I still use gzipping on most of my sites even non-phpld pages. Even joomla does too...
hey anon, do you still think its gzip compression that made you lose MSN rankings?
I think its **censored****censored****censored** if its true as I believe MSN even uses gzip compression... their spiders really suck if true!
Google and Yahoo had no problems, but msn... no go.
zlib.output_compression = On
Don't touch anything else, and restart your Apache.
Cheers
I was highly pissed off because I was ranked 5th on msn for some extreeeeemely high searched keyword phrases, and now because of the compression, my title is 1. borked to hell 2. I am nowhere in site now.
I was doing between 4-600 in ypn a month and now i barely hit 100.
grrrrrr
I would say yes for the most part.
The main thing I don't like about gzipping right now is MSN's search engine can't seem to read gzipped pages. Stupid I know, but what else can I say?
:D :D him, boby, anon, VSDan, proprod :D :D they can all have free reign on my directories lolol
I think its **censored****censored****censored** if its true as I believe MSN even uses gzip compression... their spiders really suck if true!
I am uncertain at this point. My rankings have climbed back up again and I am listed top 5 for some great key terms. Still the problem of the garbled description remains. How in the hell do I get it out is beyond me. Their sipder visits my site enough to be able to correct it, but they seem to be taking their sweet time abotu it. *sigh*
3.3 is built in.
php_flag zlib.output_compression On
php_value zlib.output_compression_level 5
But make sure your hoster and webserver allows it, else you'll get a 500/Internal Server Error if it's disabled.
Boby
Warning: ob_start(): output handler 'ob_gzhandler' conflicts with 'zlib output compression' index.php on line 4
I asked my host already and i saw the php.ini...the compression is on and the level is 5. what i do wrong?
#If you have any other info about this subject , Please add it free.# |