tivicrdotcom Posted January 31, 2012 Share Posted January 31, 2012 In order to Optimize Your Site Using Compression, my hosting provider asked me to: Add the following code to the very top of your Web pages above the DOCTYPE: <?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?> This code is added where? header.tpl? Adding that before DOCTYPE won't trigger quirks mode? Thanks and best regards, AJ Link to comment Share on other sites More sharing options...
El Patron Posted January 31, 2012 Share Posted January 31, 2012 let's assume for a second that since they asked you to put this code in that mod_deflate is actually installed on your server. Then add this (for example) to you .htaccess file. You can do this from the back office, preferences-->performance...pastE this or something similar into the box and click generate .htaccess I am assuming you have a 1.4+ system. If not or the box is not there to paste the code, then just edit your .htaccess and paste it in. # FROM A 1.4.6.2 PS GENERATION <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript </IfModule> read on Link to comment Share on other sites More sharing options...
tivicrdotcom Posted January 31, 2012 Author Share Posted January 31, 2012 Parse! Thanks for replying brother! I am also assuming it's installed on the server since all they send me was this link. So I am just gonna add the code: # FROM A 1.4.6.2 PS GENERATION <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript </IfModule> On the very top of my .htaccess file right? It gets called on every page? Is there a way to know if it's working? Thanks mijo! AJ Link to comment Share on other sites More sharing options...
tivicrdotcom Posted February 1, 2012 Author Share Posted February 1, 2012 Dude I was actually reading the documentation on the link I sent you above and they ask to insert this code on the top of my webpages, imagine going one by one hahaha ... <?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?> So the code you sent me above replaces this one by adding it to the .htaccess file right? You achieve the same compression? Or am I missing something here? This php string still should be inserted on the header.tpl? Link to comment Share on other sites More sharing options...
El Patron Posted February 1, 2012 Share Posted February 1, 2012 ...the mod_deflate works at the apache level via either the httpd.conf or via definitions in the .htaccess. The php string you mention would not be needed with 1) httpd.conf or 2) .htaccess change. If the code already exists in your .htaccess and you are not getting compression, then the required module is not loaded. Link to comment Share on other sites More sharing options...
tivicrdotcom Posted February 1, 2012 Author Share Posted February 1, 2012 Thanks Patrón, I used a tool to verify gzip compressing and indeed my site tivicr.com/tienda is compressing but I still feel my site is quite slow the first time it loads so I might have to sacrifice the nivo slider and the accordion Link to comment Share on other sites More sharing options...
El Patron Posted February 1, 2012 Share Posted February 1, 2012 post your url or pm it to me....I can take a look to and see if any other bug a boos. Link to comment Share on other sites More sharing options...
tivicrdotcom Posted February 1, 2012 Author Share Posted February 1, 2012 Thanks dude! Here is the site http://tivicr.com/tienda I like the slider but on second though I can use only one animation, the nivo slider, and load all images there! Anyhow, I appreciate your input! Link to comment Share on other sites More sharing options...
tivicrdotcom Posted February 1, 2012 Author Share Posted February 1, 2012 Patrón, it also seems as if after the .htaccess config is throwing that /es at the end, is that beneficial? It's simply stating that the index language is Spanish nut somehow I dislke that showing on the url! Link to comment Share on other sites More sharing options...
El Patron Posted February 1, 2012 Share Posted February 1, 2012 the es is required for standard url rewrite in Prestashop. do you have firebug loaded on a firefox browser? Link to comment Share on other sites More sharing options...
tivicrdotcom Posted February 1, 2012 Author Share Posted February 1, 2012 I do hermano! Link to comment Share on other sites More sharing options...
tivicrdotcom Posted February 2, 2012 Author Share Posted February 2, 2012 So I was able to know down 7 seconds by simply removing the accordion slide show and leaving only the nivo slider. So in order to close this post, let's sum up: - If your server ha enable gzip compression you should definitely do it. - Add the following code into your .htaccess file: # FROM A 1.4.6.2 PS GENERATION <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript </IfModule> - Check if your site is compressing by visiting ths link. You'll get instant results on percentage compressed, etc. Special thanks to el patron for collaborating on this subject! Happy selling!!! AJ Link to comment Share on other sites More sharing options...
Rhobur Posted February 2, 2012 Share Posted February 2, 2012 To me, the tool above gives the error : "Sorry, I am unable to decompress the contents of this page. Possible bogus gzip/deflate encoded data." What could that mean ? I've checked the .htaccess and seems all right ! Link to comment Share on other sites More sharing options...
El Patron Posted February 2, 2012 Share Posted February 2, 2012 To me, the tool above gives the error : "Sorry, I am unable to decompress the contents of this page. Possible bogus gzip/deflate encoded data." What could that mean ? I've checked the .htaccess and seems all right ! Hi Rhobur, This topic has been marked solved. You would be better served by the community by opening a new thread with your description. Link to comment Share on other sites More sharing options...
tivicrdotcom Posted February 2, 2012 Author Share Posted February 2, 2012 Hi dude, Indeed opening a new topic would be better as there's probably a bunch of people having the same error. Open a new topic ("gzip compression unable to decompress" or something like that) and in the mean time check the official site of gzip compressing. If they solve your issue, still post it on the forum as it could be helpful to other members. Good Luck! Best Regards, AJ Link to comment Share on other sites More sharing options...
Rhobur Posted February 3, 2012 Share Posted February 3, 2012 Ok guys, you're probably right! My bad! Opening a new topic... Link to comment Share on other sites More sharing options...
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