Support » Plugin: SiteGround Optimizer » SG Optimizer & GTmetrix Expires Headers issue

  • Resolved cezarina

    (@cezarina)


    Hello,

    I need your help on this. GTmetrix is telling me that There are 44 static components without a far-future expiration date. Here is the link
    But I use SG Optimizer and it seems that many of the components there are set to far-future expiration date. How come these 44 are not covered? Is there a way to improve that? Thanks you very much.

    @hristo-sg

    Below are the SG Optimiser expiration dates in .htaccess

    # HTTPS forced by SG-Optimizer
    <IfModule mod_rewrite.c>

    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    </IfModule>
    # END HTTPS
    # START PHP VERSION CHANGE forced by SG Optimizer
    AddHandler application/x-httpd-recommended-php .php .php5 .php4 .php3
    # END PHP VERSION CHANGE
    SetEnv PHPRC /home/bootsand/public_html/romaniaprivatetours.com/php.ini

    # Leverage Browser Caching by SG-Optimizer
    <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault “access plus 6 months”
    # CSS
    ExpiresByType text/css “access plus 1 year”
    # HTML components (HTCs)
    ExpiresByType text/x-component “access plus 2 months”
    # HTML
    ExpiresByType text/html “access plus 6 months”
    # JavaScript
    ExpiresByType application/javascript “access plus 1 year”
    ExpiresByType application/x-javascript “access plus 1 year”
    # Manifest files
    ExpiresByType application/x-web-app-manifest+json “access plus 0 seconds”
    ExpiresByType text/cache-manifest “access plus 0 seconds”
    # Media
    ExpiresByType audio/ogg “access plus 1 year”
    ExpiresByType image/gif “access plus 1 year”
    ExpiresByType image/jpg “access plus 1 year”
    ExpiresByType image/jpeg “access plus 1 year”
    ExpiresByType image/png “access plus 1 year”
    ExpiresByType image/svg “access plus 1 year”
    ExpiresByType image/svg+xml “access plus 1 year”
    ExpiresByType video/mp4 “access plus 1 year”
    ExpiresByType video/ogg “access plus 1 year”
    ExpiresByType video/webm “access plus 1 year”
    ExpiresByType image/x-icon “access plus 1 year”
    ExpiresByType application/pdf “access plus 1 year”
    ExpiresByType application/x-shockwave-flash “access plus 1 year”
    # Web feeds
    ExpiresByType application/atom+xml “access plus 1 hour”
    ExpiresByType application/rss+xml “access plus 1 hour”
    # Web fonts
    ExpiresByType application/font-woff “access plus 1 year”
    ExpiresByType application/font-woff2 “access plus 1 year”
    ExpiresByType application/vnd.ms-fontobject “access plus 1 year”
    ExpiresByType application/x-font-ttf “access plus 1 year”
    ExpiresByType font/opentype “access plus 1 year”
    </IfModule>
    # END LBC
    # GZIP enabled by SG-Optimizer
    <IfModule mod_deflate.c>
    <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE “application/atom+xml” \
    “application/javascript” \
    “application/json” \
    “application/ld+json” \
    “application/manifest+json” \
    “application/rdf+xml” \
    “application/rss+xml” \
    “application/schema+json” \
    “application/vnd.geo+json” \
    “application/vnd.ms-fontobject” \
    “application/x-font-ttf” \
    “application/x-javascript” \
    “application/x-web-app-manifest+json” \
    “application/xhtml+xml” \
    “application/xml” \
    “font/eot” \
    “font/opentype” \
    “image/bmp” \
    “image/svg+xml” \
    “image/vnd.microsoft.icon” \
    “image/x-icon” \
    “text/cache-manifest” \
    “text/css” \
    “text/html” \
    “text/javascript” \
    “text/plain” \
    “text/vcard” \
    “text/vnd.rim.location.xloc” \
    “text/vtt” \
    “text/x-component” \
    “text/x-cross-domain-policy” \
    “text/xml”
    </IfModule>
    </IfModule>
    # END GZIP

    # BEGIN WordPress
    # The directives (lines) between BEGIN WordPress and END WordPress are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    # Wordfence WAF

    # END Wordfence WAF

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    Your site is in a folder as an addon. As such all rules in your public_html folder affect it including these:

    <IfModule mod_headers.c>
        Header set Cache-Control "no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Expires 0
    </IfModule>

    Remove them unless you have speciffic reasons to use them and your issue will be solved.

    Thread Starter cezarina

    (@cezarina)

    Thank you very much, @hristo-sg!
    I deleted the rules above and the static components went down to 10 which are mainly third parties (Google and Facebook). Despite all this, Add Expired Headers under YSlow is still F(0). And the loading speed haven’t improved a bit. Any idea why?

    Also the First Byte Time on Webpagetest.org fropped from A to D.

    Appreciate your help,

    Best wishes,
    Cezarina

    • This reply was modified 2 years, 2 months ago by cezarina.
    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    Because you have too many external scripts used. By the way I would just ignore YSlow completely. It doesn’t really matter if your site is loading as fast as it is.

    Thread Starter cezarina

    (@cezarina)

    Thanks, Hristo!

    @hristo-sg

    How about the First Byte Time? Is there anything I can do to improve that?

    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    Yes, don’t test your site hosted in our Netherlands DC from Australia πŸ™‚

    https://www.webpagetest.org/result/200421_3W_0864f72f5354bb59692e9c4eab1805e0/

    For me, TTFB for your site is 62ms

    Thread Starter cezarina

    (@cezarina)

    I know Europe is not an issue, but I also target clients in Australia πŸ™‚
    What if they’re not patient enough?
    I tried Cloudflare as CDN and the outcome was not great. So I decided to deactivate it.

    Thank you very much for your help, Hristo! (@hristo-sg)
    If you see anything that I can do to improve the FBT please share it with me

    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    I would try Google CDN for example πŸ™‚

    Thread Starter cezarina

    (@cezarina)

    I’ll have a look into it!

    Thank you very much for your help Hristo!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘SG Optimizer & GTmetrix Expires Headers issue’ is closed to new replies.