Title: Change cache directory
Last modified: August 30, 2016

---

# Change cache directory

 *  [softcodex](https://wordpress.org/support/users/softcodex/)
 * (@softcodex)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/change-cache-directory-2/)
 * Hi,
 * is it possible to change the default cache directory?
 * Is it possible to put all the W3 files in these directories:
 * ../wp-content/uploads/cache/
    ../wp-content/uploads/w3tc-config/
 * Regards
 * [https://wordpress.org/plugins/w3-total-cache/](https://wordpress.org/plugins/w3-total-cache/)

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

 *  [Kimberly](https://wordpress.org/support/users/amiga500/)
 * (@amiga500)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/change-cache-directory-2/#post-6708021)
 * In your **functions.php** check for the existence of and then re-define one or
   more of these constants:
 * **W3TC_CACHE_DIR**
    _defaults to:_ WP_CONTENT_DIR . ‘/cache’
 * **W3TC_CONFIG_DIR**
    _defaults to:_ WP_CONTENT_DIR . ‘/w3tc-config’
 * **W3TC_CACHE_CONFIG_DIR**
    _defaults to:_ W3TC_CACHE_DIR . ‘/config’
 * **W3TC_CACHE_MINIFY_DIR**
    _defaults to:_ W3TC_CACHE_DIR . ‘/minify’
 * **W3TC_CACHE_PAGE_ENHANCED_DIR**
    _defaults to:_ W3TC_CACHE_DIR . ‘/page_enhanced’
 * **W3TC_CACHE_TMP_DIR**
    _defaults to:_ W3TC_CACHE_DIR . ‘/tmp’
 * Cheers
    Kimberly
 *  Thread Starter [softcodex](https://wordpress.org/support/users/softcodex/)
 * (@softcodex)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/change-cache-directory-2/#post-6708026)
 * Which file **functions.php** do you mean?
 *  Thread Starter [softcodex](https://wordpress.org/support/users/softcodex/)
 * (@softcodex)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/change-cache-directory-2/#post-6708028)
 * OK founded.
    The right place is in the **wp-content/plugins/w3-total-cache/inc/
   define.php** file.
 * Find and add a new folder (wherever you want):
    `defined('WP_CONTENT_DIR') ||
   define('WP_CONTENT_DIR', realpath(W3TC_DIR . '/../../MY-NEW-FOLDER'));`
 * or like I did (so that al these files are in the _uploads_ folder)
 * `defined('WP_CONTENT_DIR') || define('WP_CONTENT_DIR', realpath(W3TC_DIR . '/../../
   uploads'));`
 * Tested and it’s ok.
 * 😉
 *  [Kimberly](https://wordpress.org/support/users/amiga500/)
 * (@amiga500)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/change-cache-directory-2/#post-6708033)
 * Great! The reason i didnt mention the direct w3tc file: “define.php” specifically
   is because if/when W3TC gets updates you will lose your changes entirely (it 
   will restore to its default directories). By making these modifications in your
   functions.php file (located in your theme’s folder) this will retain your changes
   across future updates. It’s your choice though. Both ways works fine — one is
   permanent.

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

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

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [default](https://wordpress.org/support/topic-tag/default/)
 * [folder](https://wordpress.org/support/topic-tag/folder/)

 * 4 replies
 * 2 participants
 * Last reply from: [Kimberly](https://wordpress.org/support/users/amiga500/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/change-cache-directory-2/#post-6708033)
 * Status: not resolved