Post by mophielle » Sun May 10, 2020 7:42 am

Hello, i can´t get my opencart 3 shop to a green pagespeed at insights on mobile advices because of no text compression (but actually i use it) and because pictures not viewable are loaded in the beginning. As well im using pictures at the desktop which have the proper size but for the mobile (responsive) version they are too big and are resized then.
Does anybody have some suggestion how to solve this problem by adding code or another htaccess line?
The code to fasten up i use in htaccess is this one:

Code: Select all

<IfModule pagespeed_module>

    ModPagespeed on

</IfModule>
<IfModule mod_expires.c>
  ExpiresActive on
 
# Perhaps better to whitelist expires rules? Perhaps.
  ExpiresDefault                          "access plus 1 month"
 
# cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
  ExpiresByType text/cache-manifest       "access plus 0 seconds"

# Your document html
  ExpiresByType text/html                 "access plus 0 seconds"
   
# Data
  ExpiresByType text/xml                  "access plus 0 seconds"
  ExpiresByType application/xml           "access plus 0 seconds"
  ExpiresByType application/json          "access plus 0 seconds"
 
# RSS feed
  ExpiresByType application/rss+xml       "access plus 1 hour"
 
# Favicon (cannot be renamed)
  ExpiresByType image/x-icon              "access plus 1 week"
 
# Media: images, video, audio
  ExpiresByType image/gif                 "access plus 1 month"
  ExpiresByType image/png                 "access plus 1 month"
  ExpiresByType image/jpg                 "access plus 1 month"
  ExpiresByType image/jpeg                "access plus 1 month"
  ExpiresByType video/ogg                 "access plus 1 month"
  ExpiresByType audio/ogg                 "access plus 1 month"
  ExpiresByType video/mp4                 "access plus 1 month"
  ExpiresByType video/webm                "access plus 1 month"
   
# HTC files  (css3pie)
  ExpiresByType text/x-component          "access plus 1 month"
   
# Webfonts
  ExpiresByType font/truetype             "access plus 1 month"
  ExpiresByType font/opentype             "access plus 1 month"
  ExpiresByType application/x-font-woff   "access plus 1 month"
  ExpiresByType image/svg+xml             "access plus 1 month"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
     
# CSS and JavaScript
  ExpiresByType text/css                  "access plus 1 year"
  ExpiresByType application/javascript    "access plus 1 year"
  ExpiresByType text/javascript           "access plus 1 year"
  ExpiresByType application/x-javascript "access 1 month" 
  ExpiresByType application/javascript "access 1 month" 
  ExpiresByType application/x-shockwave-flash "access 1 month" 
  ExpiresByType image/x-icon "access 1 month"
    
  <IfModule mod_headers.c>
    Header append Cache-Control "public"
  </IfModule>
</IfModule>
<IfModule mod_deflate.c>
    SetOutputFilter DEFLATE
    <IfModule mod_setenvif.c>
        # 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

        # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
        # the above regex won't work. You can use the following
        # workaround to get the desired effect:
        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

        # Don't compress images
        SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
    </IfModule>

    <IfModule mod_headers.c>
        # Make sure proxies don't deliver the wrong content
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
</IfModule>
Maybe a clue about a mistake?

I configured my server as well and get a page speed around 90-94 on desktop but mobile devices is sometimes red, sometimes yellow.

Would be nice if someone can help.
Last edited by straightlight on Mon May 11, 2020 12:31 am, edited 1 time in total.
Reason: Added code tags.

New member

Posts

Joined
Wed Jun 03, 2015 2:33 am

Post by ADD Creative » Sun May 10, 2020 11:35 pm

For the compression issue. What is Output Compression Level set to in your Opencart settings (in server tab)?

You probably don't want to be messing with the cache control headers.

Code: Select all

<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>
I doubt there will be much you can fix by adding to your htaccess. It's usually a case of going through the issus one by one.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by paulfeakins » Mon May 11, 2020 7:56 pm

mophielle wrote:
Sun May 10, 2020 7:42 am
Hello, i can´t get my opencart 3 shop to a green pagespeed at insights on mobile advices because of no text compression (but actually i use it) and because pictures not viewable are loaded in the beginning. As well im using pictures at the desktop which have the proper size but for the mobile (responsive) version they are too big and are resized then.
Does anybody have some suggestion how to solve this problem by adding code or another htaccess line?
This is complex stuff so you should probably pay a developer such as ourselves or post a job in the Commercial Support Forum.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: samm91 and 19 guests