WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Justin Carroll
    Member
    Posted 2 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_).*$
    # ADDED THIS LINE TO PASS-THROUGH MOBILE USER AGENTS
    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?

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 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
    Member
    Posted 2 years ago #

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

  4. Stefan
    Member
    Posted 1 year 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

About this Topic