Last updated on

Fix Document Root Path

Default: Disabled

What does this setting do?

Enabling this setting instructs W3 Total Cache to use the absolute path when resolving paths for files within your WordPress installation. By default, when using the “disk” or “disk enhanced” engines for various features, W3TC will use the server document root which may not resolve correctly if files/folders are symbolically linked from alternate locations in the server’s filesystem.

Real World Example

This setting is particularly useful in cases where symlinks are used for your WordPress directories, like have a shared /plugins directory for all your sites on the same server.

For example, your WordPress plugin files are installed in:

  • /var/www/wordpress/public/wp-content/plugins

but are symlinked to:

  • /home/wordpress/SITE1/public_html/wp-content/plugins
  • /home/wordpress/SITE2/public_html/wp-content/plugins

Without this setting enabled with the above example configuration, W3TC will resolve file paths to /var/www/... rather than /home/wordpress/... which will result in failures to read and/or write files. This will affect the various caches using the “disk” or “disk enhanced” engines, Minify, and can affect .htaccess modifications required for some of these features to function properly.

How can I tell if symlinked directories are preventing W3 Total Cache from working correctly?

If W3TC is not working correctly and you are not using an symlinked directories in your server filesystem then it is unlikely that enabling this setting will fix the issues you are experiencing. Most WordPress hosting providers do not typically use symlinked directories in their standard server configurations and it is unlikely that you will encounter this kind of configuration in most cases.

You can test if W3TC is writing to the correct directories by first enabling features like Browser Cache, Page Cache, and Minify. Then check the .htaccess in the root directory of your WordPress installation and confirm that the directives W3TC have been added to that file. If the rules are not present after changing the settings and you are using a symlinked setup, then enabling this option might get W3 Total Cache functioning correctly.
 

W3 Total Cache

You haven't seen fast until you've tried PRO

   Full Site CDN + Additional Caching Options
   Advanced Caching Statistics, Purge Logs and More

Everything you need to scale your WordPress Website and improve your PageSpeed.

Leave a Reply

Your email address will not be published. Required fields are marked *

W3 Total Cache logo

We Can Help Optimize Your Website

Optimize your site’s performance with our one-time premium services or ongoing monthly VIP support. View services

Got a Minute?

Your feedback helps us improve. Complete our customer survey now.

Partners

Bunny CDN Logo