• Resolved luciano9876

    (@luciano9876)


    Is it possible to change the cache directory to a directory outside the wordpress directory?
    Suppose the wordpress directory is: /var/www/domainname/public_html/
    Then comet cache suggests the cache directory be in /var/www/domainname/public_html/wp-content/

    Instead of that I would like the cache directory be in:
    /var/www/domainname/cache

    The only way I found is editing advanced-cache.php but that file is overwritten each time I change any setting. Is there another way to accomplish this? Or would it be possible to create that possibility in the next update?

Viewing 4 replies - 1 through 4 (of 4 total)
  • @luciano9876 Comet Cache builds the cache path using the WordPress constant WP_CONTENT_DIR. While you can change the Comet Cache cache path inside the wp-content/ directory right from the plugin options (Comet Cache → Plugin Options → Cache Directory), if you want to change the the path below that (e.g., the path to wp-content/), you’ll need to modify WP_CONTENT_DIR constant.

    Thread Starter luciano9876

    (@luciano9876)

    @raamdev Thank you for your prompt response. Maybe I am mistaken, but this does not seem a solution to what I asked. It seems to just change the location of the entire directory with the cache directory still in it, instead of outside the public_html directory.

    I found a solution that worked however.
    As cache directory I put this in the plugin: ../../cache/comet-cache
    That way the cache is outside the public_html directory, separated from the other content, as I want it, without the need to hack anything. On top of that it is update safe. 🙂
    (cache in ~/domainname/cache/comet-cache; wp-content in ~/domainname/public_html/wp-content)

    @luciano9876 Ah, yes, that will also work in some scenarios. It really depends on your server configuration. In many hosting environments that won’t work because the server configuration will prevent WordPress from writing things outside of the public_html/ directory.

    In fact, you’ll want to double-check that everything is working as expected. For example, I know if you were using the HTML Compressor feature of Comet Cache Pro, for example, and having Comet Cache combine and minify your CSS/JS files, those combined and cached JS/CSS files would need to be stored in a cache directory that’s publicly accessible, i.e., something inside the public_html/ directory, since Comet Cache would inject URLs to those files into the web page.

    In any case, if it’s working for you, great! 🙂

    Thread Starter luciano9876

    (@luciano9876)

    @raamdev Thanks for the warning. It seems to work. I cannot see anything strange happening, but I probably should have mentioned that it’s on a VPS. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Changing the cache directory’ is closed to new replies.