• Resolved linortek

    (@linortek)


    I installed Autoptimize early this week, it helped me fix some of the issues on my website, I am quite happy with this plugin still. But when I did GTmetrix testing, I found that some of the Autoptimized files appeared on the testing result that need to Leverage browser caching and Add Expires headers. Below are the expires header settings on my .htaccess file, what else should I do to fix this issue? Thanks:

    <FilesMatch “.(ico|pdf|flv|jpg|jpeg|png|gif|svg|js|css|swf)$”>
    Header set Cache-Control “max-age=84600, public”
    </FilesMatch>
    ## EXPIRES HEADER CACHING ##
    ExpiresActive On
    ExpiresByType image/jpg “access 1 year”
    ExpiresByType image/jpeg “access 1 year”
    ExpiresByType image/gif “access 1 year”
    ExpiresByType image/png “access 1 year”
    ExpiresByType image/svg “access 1 year”
    ExpiresByType text/css “access 1 month”
    ExpiresByType application/pdf “access 1 month”
    ExpiresByType application/javascript “access 1 month”
    ExpiresByType application/x-javascript “access 1 month”
    ExpiresByType application/x-shockwave-flash “access 1 month”
    ExpiresByType image/x-icon “access 1 year”
    ExpiresDefault “access 1 month”
    ## EXPIRES HEADER CACHING ##

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Had a quick look; you have cache-control saying public, max-age=84600 as per your config but expires is Sat, 17 Nov 2018 14:43:53 GMT which is only 1 day;

    By default AO does not actively set expires headers, it just has an .htaccess in wp-content/cache/autoptimize/.htaccess file that tries has;

    <IfModule mod_expires.c>
            ExpiresActive On
            ExpiresByType text/css A30672000
            ExpiresByType text/javascript A30672000
            ExpiresByType application/javascript A30672000
    </IfModule>
    <IfModule mod_headers.c>
        Header append Cache-Control "public, immutable"
    </IfModule>

    So could be that your Apache is ignoring AO’s .htaccess, could be that Cloudflare is overwriting the expires header?

    An alternative might be to untick the “serve as static files”-option in AO, in which case PHP-code will try setting good headers (don’t know if Cloudflare will leave those be though).

    hope this helps,
    frank

    Thread Starter linortek

    (@linortek)

    Frank,
    Thank you very much for the advise! Unfortunately I don’t know any code, I can only install plugins to fix the problem I can find for my website :-(. Before I installed Autopmitize plugin, I have 95 files without expire date even I have that settings in the .htaccess file. Do you have any suggestions of changing that “public, max-age=84600” value so that I can see if that fix the issue? Thanks!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, 2 things I would try if I were you;
    * check cloudflare settings (e.g. minify at cloudflare level might have got to do with this)
    * tell AO to deliver the files using PHP by disabling the “serve as static files”-option?

    happy optimizing!
    frank

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Autoptimize helped me fix some issues, but itself has issue?’ is closed to new replies.