Monta Posted January 26, 2012 Share Posted January 26, 2012 Hi! I´m having a bit of a problem here, im trying to activate gzip compression throw the .htaccess file. I followed the tutorial at prestatraining but with no result. I appreciate any help, thx Serverinformation PrestaShop Version: 1.4.2.5 Server-information: Linux #1 SMP Version of serverprogram: LiteSpeed PHP Version: 5.2.17 .htaccess ..... <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/gif "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType text/css "access plus 1 week" ExpiresByType text/javascript "access plus 1 week" ExpiresByType application/javascript "access plus 1 week" ExpiresByType application/x-javascript "access plus 1 week" ExpiresByType image/x-icon "access plus 1 year" </IfModule> FileETag INode MTime Size <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> Link to comment Share on other sites More sharing options...
Monta Posted January 28, 2012 Author Share Posted January 28, 2012 Solved, The solution is to change from version of the server-program from Litespeed to Apache. 1 Link to comment Share on other sites More sharing options...
Frankie84 Posted August 7, 2013 Share Posted August 7, 2013 (edited) Our gzip was disabled when I turned on apache optimization setting in v 1.5.4. This caused the following code to be added: <IfModule mod_deflate.c> <IfModule mod_filter.c> AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript </IfModule> </IfModule> To enable it again I just replaced with the following code to the .htaccess: <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> And, it was enabled again. Edited August 7, 2013 by frsa1984 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 7, 2013 Share Posted August 7, 2013 it's a bit old topic, anyway, i've got question your solution works well also in other ps 1.5.x versions? Link to comment Share on other sites More sharing options...
Frankie84 Posted August 7, 2013 Share Posted August 7, 2013 I just know it works for 1.5.4. It was really easy to do this, however, I did not find this exact solution. Took hours to find this method of re-enabling gzip. Which is why I posted. Important piece of info: I am using a godaddy VPS. In godaddy shared hosting accounts the original code with the <IfModule mod_filter.c> worked fine, I did not have to change it. 1 Link to comment Share on other sites More sharing options...
ALMAJ Posted February 25, 2014 Share Posted February 25, 2014 it's a bit old topic, anyway, i've got question your solution works well also in other ps 1.5.x versions? Hi vekia How can I enable compression to themes/default/cache? this is what i get from PageSpeed Insights and gtmetrix.com: Compressing the following resources with gzip could reduce their transfer size by 247.8KiB (73% reduction). Compressing http://www.tekcenter...894ca5515689.jscould save 152.2KiB (69% reduction). Compressinghttp://www.tekcenter...b9d80ce_all.css could save 80.7KiB (82% reduction). Compressing http://www.tekcenter...pluginDetect.js could save 14.9KiB (65% reduction). My prestashop version is: 1.5.6.2 (Default theme) my current .htaccess code is this: <IfModule mod_rewrite.c> <IfModule mod_env.c> SetEnv HTTP_MOD_REWRITE On </IfModule> RewriteEngine on RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule . - [E=REWRITEBASE:/store/] RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L] # Images RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L] RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L] RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L] RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L] RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L] RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L] RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L] RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L] RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L] RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L] # AlphaImageLoader for IE and fancybox RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L] # Dispatcher RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^.*$ - [NC,L] RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$ RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L] </IfModule> <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/gif "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType text/css "access plus 1 week" ExpiresByType text/javascript "access plus 1 week" ExpiresByType application/javascript "access plus 1 week" ExpiresByType application/x-javascript "access plus 1 week" ExpiresByType image/x-icon "access plus 1 year" </IfModule> FileETag INode MTime Size <IfModule mod_deflate.c> <IfModule mod_filter.c> AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript </IfModule> </IfModule> Best regards. Link to comment Share on other sites More sharing options...
El Patron Posted March 6, 2014 Share Posted March 6, 2014 Our gzip was disabled when I turned on apache optimization setting in v 1.5.4. This caused the following code to be added: <IfModule mod_deflate.c> <IfModule mod_filter.c> AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript </IfModule> </IfModule> To enable it again I just replaced with the following code to the .htaccess: <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> And, it was enabled again. Just a follow up on this. At some point in 1.5's evolution the native .htaccess is built like this: <IfModule mod_deflate.c> <IfModule mod_filter.c> AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript </IfModule> </IfModule> so for some (maybe many) if they upgrade and/or use then you MUST also make sure that mod_filter is enabled on your server. I found this out while testing in 1.5.6.2 locally. Where it used to work, when they added mod_filter it did not work because it was not loaded and was a new requirement. Link to comment Share on other sites More sharing options...
myseo59 Posted July 25, 2014 Share Posted July 25, 2014 Hi, I just want to know how can we compress by gzip theme/cache css and js? I czn win 2 seconds with that. I've tried to add another .htaccess in my /theme/default, actived ccc and add gzip compression to my www/.htaccess but i still have a non compress all.css and all.js files.... Somebody has an idea? For info, my compression code in my www/.htaccess : # Compression pour fichiers CSS <IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_minimum_file_size 1024 mod_gzip_maximum_file_size 100000 mod_gzip_item_include file \.css$ mod_gzip_item_include mime ^text/css$ </IfModule> # Compression pour fichiers JS <IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_minimum_file_size 512 mod_gzip_maximum_file_size 1000000 mod_gzip_item_include file \.js$ mod_gzip_item_include mime ^application/x-javascript.* </IfModule> Link to comment Share on other sites More sharing options...
El Patron Posted July 25, 2014 Share Posted July 25, 2014 Hi, I just want to know how can we compress by gzip theme/cache css and js? I czn win 2 seconds with that. I've tried to add another .htaccess in my /theme/default, actived ccc and add gzip compression to my www/.htaccess but i still have a non compress all.css and all.js files.... Somebody has an idea? For info, my compression code in my www/.htaccess : # Compression pour fichiers CSS <IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_minimum_file_size 1024 mod_gzip_maximum_file_size 100000 mod_gzip_item_include file \.css$ mod_gzip_item_include mime ^text/css$ </IfModule> # Compression pour fichiers JS <IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_minimum_file_size 512 mod_gzip_maximum_file_size 1000000 mod_gzip_item_include file \.js$ mod_gzip_item_include mime ^application/x-javascript.* </IfModule> this is best researched outside of PretstaShop, this is not a feature 'other than enabling and create base declarations). in other words there is much more expertise in other forums for this sort of posting. go there for best results. Link to comment Share on other sites More sharing options...
oh_prestashop Posted March 10, 2015 Share Posted March 10, 2015 (edited) Hi, I just want to know how can we compress by gzip theme/cache css and js? I czn win 2 seconds with that. I've tried to add another .htaccess in my /theme/default, actived ccc and add gzip compression to my www/.htaccess but i still have a non compress all.css and all.js files.... Somebody has an idea? I have the same question. I've enabled and set up mod_deflate however Google Page Speed Insights states that my theme's minified CSS + JS is not compressed. @myseo59 Have you found a solution for this? EDIT: [sOLVED] I found out those files were delivered by nginx. Just had to enable compression for nginx. Edited March 11, 2015 by oh_prestashop (see edit history) Link to comment Share on other sites More sharing options...
ugnelakys Posted March 12, 2015 Share Posted March 12, 2015 I have the same question. I've enabled and set up mod_deflate however Google Page Speed Insights states that my theme's minified CSS + JS is not compressed. @myseo59 Have you found a solution for this? EDIT: [sOLVED] I found out those files were delivered by nginx. Just had to enable compression for nginx. May apache has no gzip module installed Link to comment Share on other sites More sharing options...
pietro Posted April 9, 2015 Share Posted April 9, 2015 it's a bit old topic, anyway, i've got question your solution works well also in other ps 1.5.x versions? Frankie84's solution worked for me in PS 1.5.6.2, thanks for posting. Link to comment Share on other sites More sharing options...
Recommended Posts