Be careful with W3 Total Cache when migrating to a new domain

WordPress has made very easy to migrate a complete site to a new domain.  It is just a matter of defining define(‘RELOCATE’,true); on your wp-confing.php and moving all files to the new domain server.

Nevertheless, some plugins are not catching up as fast as they should, and when you do this kind of relocation, the whole site will be all screw because of these plugins.  One of them is W3 Total Cache.

The plugin doesn’t recognize this change and tries to serve all cache using the old domain references, this causes many errors on your site after the migration, like the following ones listed here:


Warning: include(/srv/disk4/jamtrading/www/ [function.include]: failed to open stream: No such file or directory in /srv/disk4/jamtrading/www/ on line 65

Warning: include() [function.include]: Failed opening ‘/srv/disk4/jamtrading/www/’ for inclusion (include_path=’.:/usr/local/php-5.3.29/share/pear’) in /srv/disk4/jamtrading/www/ on line 65
W3 Total Cache Error: some files appear to be missing or out of place. Please re-install plugin or remove /srv/disk4/jamtrading/www/

You can see that the plugin is trying to call advanced-cache.php and db.php, but these files are, for a reason, stuck to the old configuration, so W3 Total Cache will not be able to work, then making the whole site unresponsive.

The solution in this case is to rename the plugin’s folders or delete them (if you don’t care about having the Total Cache installed this is a better option)

Be sure to rename:

  • w3tc-config folder
  • w3-total-cache folder
  • delete db.php
  • delete advanced-cache.php

After you do this, just login at normal using wp-login.php and you’ll see how your site comes back to life.

Enjoy that magical moment!