• Resolved scottstone

    (@scottstone)


    My server (Pantheon) does not allow writing to any directory other than wp-content/uploads for security reasons. Is it possible to move my cache directory into wp-content/uploads?

    Per this FAQ it sounds like I can but I also suspect this is an outdated or different solution.

    Can I change the directory & filename of cached autoptimize files?
    Yes, if you want to serve files from e.g. /wp-content/resources/aggregated_12345.css instead of the default /wp-content/cache/autoptimize/autoptimize_12345.css, then add this to wp-config.php:

    define('AUTOPTIMIZE_CACHE_CHILD_DIR','/resources/');
    define('AUTOPTIMIZE_CACHEFILE_PREFIX','aggregated_');

    I added these two lines to the end of my wp-config.php file using /uploads/ instead of /resources/ but it did not work. I assume this does not actually move the directory.

    Pantheon suggested I set-up a symlink (https://pantheon.io/docs/articles/sites/files/non-standard-files-locations/) using Git but this is getting beyond my technical level. I am not a developer. Any help moving the cache directory to a sub-directory of uploads is much appreciated.

    https://www.ads-software.com/plugins/autoptimize/

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

    (@futtta)

    hi scott;
    just did a quick test and

    define('AUTOPTIMIZE_CACHE_CHILD_DIR','/uploads/cache/');

    does do the trick. I do however remember reading that the place where you add these, is important, so maybe try adding this more at the beginning of wp-config.php?

    hope this helps,
    frank

    There is small error log appers, when ‘AUTOPTIMIZE_CACHEFILE_PREFIX’ is set to ”, when you want files names to contain only md5 hash:

    "strpos(): Empty needle" in file "classes\autoptimizeCache.php on line 131"
    ( strpos($file,AUTOPTIMIZE_CACHEFILE_PREFIX) !== false) )

    So you have to pass at least ‘_’ for ‘AUTOPTIMIZE_CACHEFILE_PREFIX’.

    • This reply was modified 8 years, 2 months ago by esemlabel.
    Plugin Author Frank Goossens

    (@futtta)

    when ‘AUTOPTIMIZE_CACHEFILE_PREFIX’ is set to ”, when you want files names to contain only md5 hash

    it never ceases to amaze me how people find unexpected ways to do things ??

    thanks for reporting & enjoy the holiday-cheer ??
    frank

    happy holidays ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change Directory’ is closed to new replies.