Jump to content

How-to enable GZIP compression on Apache2? I have apache-mod_deflate!


Recommended Posts

Hello, I can see at last point of step 2 of installation process RED text:

GZIP compression is on (recommended)

I install PrestaShop on my own Apache2 system with correct module: apache-mod_deflate-2.2.17-3.i686.
I have in PHPINFO this information:

Loaded Modules core prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_groupfile mod_authz_user mod_env mod_expires mod_headers mod_include mod_negotiation mod_setenvif mod_speling mod_version mod_authz_host mod_log_config mod_mime mod_mime_magic mod_userdir mod_deflate mod_dir mod_php5

Apache Environment \ HTTP_ACCEPT_ENCODING gzip,deflate
HTTP Headers Information \ Accept-Encoding gzip,deflate
PHP Variables \ _SERVER["HTTP_ACCEPT_ENCODING"] gzip,deflate

My config /:

# $Id: apache-mod_deflate.conf,v 1.10 2009/05/26 15:14:24 psz Exp $
LoadModule deflate_module        modules/mod_deflate.so

# Safe but working settings - compress only that types:
AddOutputFilterByType DEFLATE application/javascript application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html 
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml

# Compress all and exclude only few things - may cause some problems:
#SetOutputFilter DEFLATE


   # Netscape 4.x has some problems...
   BrowserMatch ^Mozilla/4 gzip-only-text/html

   # Netscape 4.06-4.08 have some more problems
   BrowserMatch ^Mozilla/4\.0[678] no-gzip

   # MSIE masquerades as Netscape, but it is fine
   BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

   SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
   SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
   SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar|iso)$ no-gzip dont-vary



   # Make sure proxies don't deliver the wrong content
   Header append Vary User-Agent env=!dont-vary



I try replace mid part to this (no effect):

# Compress all and exclude only few things - may cause some problems:

SetOutputFilter DEFLATE



and to this (no effect, too):

# Compress all and exclude only few things - may cause some problems:
SetOutputFilter DEFLATE



Can you have any idea? Thanks for any help.
SiB

Link to comment
Share on other sites

  • 3 years later...

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).

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= [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p//jpg [L]
RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p///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////$1jpg [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////$4/$1jpg [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////$4/$5/$1jpg [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////$4/$5/$6/$1jpg [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////$4/$5/$6/$7/$1jpg [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////$4/$5/$6/$7/$8/$1jpg [L]
RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/jpg [L]
RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/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/ [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

  • 6 months later...

 

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).

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= [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p//jpg [L]
RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p///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////$1jpg [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////$4/$1jpg [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////$4/$5/$1jpg [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////$4/$5/$6/$1jpg [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////$4/$5/$6/$7/$1jpg [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////$4/$5/$6/$7/$8/$1jpg [L]
RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/jpg [L]
RewriteCond %{HTTP_HOST} ^www.tekcenter.pt$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/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/ [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.

 

 

Did you fixed this? If so, could you please explain how?

Link to comment
Share on other sites

  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...