I have setup this wordpress installation as a network of sites using the built in WordPress support for site networks. All of the sites are running on separate domains but WordPress is setup to use subdirectories for the different sites. So this blog is actually installed at /nsilverbullet in wordpress. To map from subdirectories to domains I am using the WordPress MU Domain Mapping plugin.
Unfortunately WordPress MU Domain Mapping and W3 Total Cache do not play nicely together… The issue isn’t actually with either plugin but with how WordPress sets itself up on each request. The two plugins are both setup and activated the way WordPress wants them to be – W3 Total Cache is activated using the advanced_caching dropin and MU Domain Mapping gets to redirect the request using sunrise.php. This is as it should be, unfortunately W3 Total Cache uses GLOBALS[‘blog_id’] to create cache keys for different blogs in a network installation. MU Domain mapping sets the current blog id when sunrise.php is executed – this occurs after advanced caching is run. So W3 Total Cache never gets the right blog id when it does output buffering(it defaults to 1 on every request) but does get the right blog id when you do admin actions on your sites. This has the unfortunate effect of creating all cache files for domainname.com_1 but when the blog_id is 2 W3 Total Cache trys to purge cache files for domainname.com_2, the cache works but is never purged automatically. Purgin manually using the Admin interface still works.
To get around this issue I have edited some of the files for W3 Total Cache, but since this is really hacky (and error prone) I am going to create a custom plugin using the action hooks which are exposed by W3 Total Cache. I’ll post it when it is completed.
I have a similar problem, but the strange thing is that happen only when I enable the mapping.
For example
if I access the new website in:
example.com/site_1 – W3 works
but when I map the domain like
site_1.com – W3 doesn’t work.
Do you think it’s a similar issue ?
Sounds like it is exactly the same issue. I never got around to wrapping my changes as a plugin – but I’ll dig into my modifications to try and find the changes that are required.