I'm using the WP Super Cache plugin and inside my theme I have code that executes differently if the site is viewed on a mobile device (iOS, Android) than a desktop browser. How do make WP Super Cache create a separate cache for each, most likely via the user agent?

Right now, I have use mod_rewrite to serve cache, which I believe WP Super Cache will cache the pages as html files to be served. Since the cache is saved from the desktop browser, the mobile browser is seeing that as well. I'd like WP Super Cache to generate two separate caches, one of mobile devices and another for desktop browser. Is this something WP Super Cache can handle or is there a better cache plugin I should be using to make this work?


3 Answers 3


There are several ways to handle mobile devices and doing it inside of single theme is builky and hard to maintain (as for me at least). More commonly this seems to be accomplished with separate templates or separate mobile-specific theme.

I don't know about WP Super Cache specifics because I hadn't used it extensively.

Plugin I currently use is W3 Total Cache. It allows you to create groups of user agents strings, for which visitors can be redirected to another theme or domain and (as I understand from description of settings) will have separate versions of cached pages.

  • Thanks Rarst! I actually just finished setting up W3 Total Cache and it seems to be working as I wanted it.
    – jaysonp
    Jan 1, 2011 at 11:29
  • jaysonp: can you share which settings you made? You can post this as an answer as well (and even accept it as your answer). Doing would benefit the whole community. Thanks!
    – hakre
    Jan 1, 2011 at 14:19

I was able to resolve this issue without using a separate theme or subdomain. I have elements of my theme that are loaded/not loaded on the server side based on the user agent (mobile/not mobile). After installing and enabling some basic caching with W3 Total Cache, I was getting desktop elements on mobile or vice versa. In W3 Total Cache User Agent Groups settings, I enabled the included 'high' group (group 1) and set Theme to Pass-Through. Pages now load appropriately for desktop and mobile devices with caching enabled.


Thanks Rarst. Your advice helped. For those who still don't know how to do this, here is what you should do:

  1. Go to W3 Total Cache control panel
  2. Choose User Agent Groups
  3. Under "User Agents" text area, paste the names of mobile devices
  4. Select the theme or enter a subdomain you want to use on mobile devices Save all settings.

That's it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.