WP Super Cache
Disable caching for mobile user agents (4 posts)

  1. Justin Carroll
    Posted 4 years ago #

    I'd like to disable caching completely (both super cache and wp cache) for either all mobile users or certain mobile user agents. I'm successfully using the hack found in this thread: http://wordpress.org/support/topic/wp-super-cache-couple-of-questions

    1.) First, I've ensured that my list of targeted user agents has been put into the "Reject User Agents" box in the Advanced tab of the WPSC settings page. 2.) Then I've added these lines to the .htacces file wherever necessary:

    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$
    RewriteCond %{HTTP_USER_AGENT} !(iPad|iPhone|iPod|Android|Danger|Playstation|BlackBerry)

    Since I've manually inserted the user agent rewrite WPSC now throws this warning on the Advanced tab of the settings page:

    A difference between the rules in your .htaccess file and the plugin rewrite rules has been found. This could be simple whitespace differences but you should compare the rules in the file with those below as soon as possible. Click the "Update Mod_Rewrite Rules" button to update the rules.

    My fear is that next time any settings are updated for WPSC my custom .htaccess code will be erased accidentally. Is there another way to go about disabling caching completely for mobile users or certain mobile user agents than this hack - one that maybe plays nice with WPSC?


  2. Donncha O Caoimh
    Plugin Author

    Posted 4 years ago #

    The rewrite rules will only update if you hit the submit form on that part of the settings page. Unfortunately that's the only way of doing it right now.

  3. Justin Carroll
    Posted 4 years ago #

    Ok, thanks for the response. Glad to know I'm doing things as correct as possible right now. Thanks again.

  4. Stefan
    Posted 3 years ago #

    Does it work to add Googlebot along with your other user agents? I tried but i still get cached content

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Super Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic