Worpress-mu + WPML + SuperCache integration

Seems to be fixed in SuperCache 0.9.5.

This is very simple patch for WPML plugin v1.2.1 and SuperCache plugin 0.8.9.1.
Download: wordpress+wpml+supercache-0.2.patch

I’ve had some problems with static caching of multilingual pages on my wordpress-mu based CMS system, running both WPML and SuperCache plugin. They both work almost good out of the box, but I’ve experienced problems for non-post pages (like site index). Webserver (serving static content prepared by Supercache) & Supercache didn’t cooperate well. and after second language switch I always received the page in the same language. This patch fixes this.

Install

Apply patch by issuing path -p0 <supercache+wmpl-0.2.patch in wp-content directory of your WordPress installation.

Background

WPML rewrites $_SERVER[REQUEST_URI] and this way removes language identificator from all URLs it serves, i.e.

dob.sk/sk -> dob.sk

But! SuperCache uses $_SERVER[REQUEST_URI] variable to compute how should be the cache page named, and because of already mentioned WPML rewrite hack, for the same page in different languages sees SuperCache only one REQUEST_URI (aha!).

The patch does simple thing, it saves original REQUEST_URI on SuperCache plugin load and than it uses this saved value to the path computations. How easy 😉