• Resolved hughforsyth

    (@hughforsyth)


    Hi Frank,

    I’ve got a small compatibility issue with SuperCache. Is there any way to specify a different directory for the cache files?

    I recently updated to 1.70 and enabled the “Save aggregated script/css as static files” which I really like? I’ve now switched this off.

    The problem is that the max age was being set to 3 seconds. This ws being set by Supercache which adds the following .htaccess file to /wp-content/cache/ directory (and therefore /wp-content/cache/autoptimize).

    # BEGIN supercache
    <IfModule mod_mime.c>
    <FilesMatch “\.html\.gz$”>
    ForceType text/html
    FileETag None
    </FilesMatch>
    AddEncoding gzip .gz
    AddType text/html .gz
    </IfModule>
    <IfModule mod_deflate.c>
    SetEnvIfNoCase Request_URI \.gz$ no-gzip
    </IfModule>
    <IfModule mod_headers.c>
    Header set Vary “Accept-Encoding, Cookie”
    Header set Cache-Control ‘max-age=3, must-revalidate’
    </IfModule>
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html A3
    </IfModule>

    # END supercache

    It’s not a fault with your plugin and maybe SuperCache should put the .htaccess in /wp-content/cache/supercache/. But an easy fix would be for me to move the Autoptimize folder to /public_html/wp-content/autoptimize.

    I’ve tried worked around this by adding a .htaccess file to /public_html/wp-content/cache/autoptimize. This worked but got deleted whenever I purged the Autoptimize cache.

    I’ve now switched back to dynamic but it would be nice to switch it back on..

    Thank you for your plugin. It’s great and the only minify I’ve ever been able to get to work well.

    The site is http://www.unitedworldschools.org/

    Thanks

    http://wordpress.org/plugins/autoptimize/

Viewing 15 replies - 1 through 15 (of 86 total)
  • Plugin Author Frank Goossens

    (@futtta)

    This is really interesting! didn’t know wp super cache forces the validity for all mime-types to a measly 3 seconds (I’ll ask Donncha).

    I’ll think about how to solve that for a next version, but guess you could just change the hardcoded path inside wp-content/plugins/autoptimize/autoptimize.php on lines 20 and 21 for now?

    Plugin Author Frank Goossens

    (@futtta)

    got confirmation from donncha (wp super cache developer) that this indeed is a small bug; the figure was supposed to be 3600 (1hour), not 3 (3 seconds). he just pushed out a new version yesterday, and that one still has this bug. a new version isn’t planned (except if critical bugs).

    I’ll probably create 1.7.1 for beginning of november to include a .htaccess in wp-content/cache/autoptimize, to override the wp super cache one in wp-content/cache.

    a temp fix (on your side) could also be to open wp-content/plugins/wp-super-cache/wp-cache.php and on line 2852 change

    $gziprules .= "<IfModule mod_headers.c>\n  Header set Vary \"Accept-Encoding, Cookie\"\n  Header set Cache-Control 'max-age=3, must-revalidate'\n</IfModule>\n";

    into

    $gziprules .= "<IfModule mod_headers.c>\n  Header set Vary \"Accept-Encoding, Cookie\"\n  Header set Cache-Control 'max-age=3600, must-revalidate'\n</IfModule>\n";

    clear the wp super cache (check if .htaccess is gone) and then the new .htaccess should contain the correct header.

    hope this helps,
    frank

    Thread Starter hughforsyth

    (@hughforsyth)

    Thanks so much Frank.

    I’ll try both updating the super cache wp-cache.php. and moving the autoptimize folder.

    For information, I also removed the “cookie” part of the vary-encoding the .htaccess I tried in /wp-content/cache/autoptimize. I might be wrong, but I can’t think of any reason whey the javascript and CSS you minify would ever need to vary by cookie.

    <IfModule mod_headers.c>
    Header set Vary “Accept-Encoding”
    Header set Cache-Control ‘max-age=604800, must-revalidate’
    </IfModule>

    Thanks
    Hugh

    Thread Starter hughforsyth

    (@hughforsyth)

    Thanks Frank, the update to wp-content/plugins/wp-super-cache/wp-cache.php has worked.

    I did need to manually delete /wp-content/cache/.htaccess as clearing the SuperCache cache did not remove it. But SuperCache did create it with the new value.

    Thanks again.
    Hugh

    is my “B” rank on webpagetest because of this bug?
    look at my test result link
    it’s show me the main page cached for 3 seconds !
    after i editing the wp-cache.php and delete .htaccess file nothing happen even .htaccess file doesn’t created again…

    it’s solved! just a little mistake…
    thank you frank you are a life saver this problem make me confused for three month and i didn’t know how can i fix it after i see this topic, thank you again <3
    new test result link

    Thank you for this, sorry could you perhaps specify what you mean by: clear the wp super cache (check if .htaccess is gone) and then the new .htaccess should contain the correct header.

    Does that mean I should uninstall it and instal again?

    Also can you please explain how this could affect the site?

    Thank you very much!

    Plugin Author Frank Goossens

    (@futtta)

    hi jronder; you need to make the change in wp-content/plugins/wp-super-cache/wp-cache.php on line 285 and then remove .htaccess in wp-content/cache, that should be it.

    Thank you Futta,

    On line 285?? initially you wrote 2852.

    You know I am very new to this and I realy do not want is to screw up something more then it is already:-(

    I found it, so I guess you meant 2852. Also when I clicked the edit code and I found the line 2852 and want to changed that number from 3(which is in blue)to 3600, it is typing in gray and does not look like it is correct thing. Am I digging into correct file??

    Do I need to replace the whole line or just changed the number?

    Plugin Author Frank Goossens

    (@futtta)

    if you are in the right file (wp-content/plugins/wp-super-cache/wp-cache.php) on line 2852 (indeed, my bad) and you see

    $gziprules .= "<IfModule mod_headers.c>\n  Header set Vary \"Accept-Encoding, Cookie\"\n  Header set Cache-Control 'max-age=3, must-revalidate'\n</IfModule>\n";

    then you can safely replace
    'max-age=3,must-revalidate'
    in that line into
    'max-age=3600,must-revalidate'

    and save your changes. do take care not to change anything else though, just add “600” after the 3 and before the comma.

    Thank you very much Futta. I did it.
    And now the new .htaccess file comes there itself? Sorry if this stupid question.

    I have there also these files, no clue what is it, but should I delte it also?
    wp-cache-ce5fbeeda620a23430bf812a2f841a40.html
    wp-cache-a725f60fed0c4bf82fa63ed380ee873c.html
    wp-cache-959a0cc076e64c9d0c6843474b603966.html

    Thank you very much Futta, perhaps you come one day to Diani beach and I can at least take you for a drink:-)

    Before I made change from 3 to 3600 my page was scoring much better: http://www.webpagetest.org/result/131030_2F_1CPT/1/pagespeed/

    An this is after change: http://www.webpagetest.org/result/131031_3X_FJW/

    Any idea what is wrong now please?

    Plugin Author Frank Goossens

    (@futtta)

    just had a look, your site seems broken. can you empty wp super cache cache?

    Sorry even when I make test on google page speed I get error on back end and the site is down!Instead the opening the site it will say me download.gz!

Viewing 15 replies - 1 through 15 (of 86 total)
  • The topic ‘Expires/Max Age compatibility with SuperCache’ is closed to new replies.