Title: Cache Vary
Last modified: February 19, 2021

---

# Cache Vary

 *  Resolved [createpop](https://wordpress.org/support/users/createpop/)
 * (@createpop)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/)
 * Hi,
 * I want to use cache vary as below:
    [https://docs.litespeedtech.com/lscache/vary/](https://docs.litespeedtech.com/lscache/vary/)
   For instance, if I separate the iPad, where to insert the following?
 *     ```
       <?php
       if (stripos($_SERVER['HTTP_USER_AGENT'],"iPad")!==false {
           echo 'This is Tablet view'; }
       else {
       echo 'this is Desktop view'; }
       ```
   
 * .htaccess code:
 *     ```
       RewriteCond %{HTTP_USER_AGENT} iPad [NC]
       RewriteRule .* - [E=Cache-Control:vary=istablet]
       ```
   
 * Thanks in advance.

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14072606)
 * There is no need to add/modify code for iPad detection. Cache plugin has a setting
   for mobile view at /wp-admin/admin.php?page=litespeed-cache.
 * Remove all existing UA’s in this pre-defined settings and set iPad as the device
   for mobile cache vary. Finally enable mobile view setting above. See if it it
   works for you.
 * Don’t forget to purge the cache.
 *  Thread Starter [createpop](https://wordpress.org/support/users/createpop/)
 * (@createpop)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14072750)
 * Thank you for your reply.
    As you said, I had set up only “iPad” as the user 
   agent on cache settings.
 * But, it has not worked on iPad Chrome. Only iPad chrome’s behavior is different
   from others. That’s why I want to separate the iPad.
 * Any suggestions?
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14072824)
 * Could you describe what is different with Chrome on iPad?
 * It is possible to seperate only Chrome on iPad, but this will completely disable
   mobile device detection in cache plugin, so it seems to be better to check what
   caused a different view only with iPad and Chrome.
    -  This reply was modified 5 years, 2 months ago by [serpentdriver](https://wordpress.org/support/users/serpentdriver/).
 *  Thread Starter [createpop](https://wordpress.org/support/users/createpop/)
 * (@createpop)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14073889)
 * Hi serpentdrive,
    Thank you for your reply.
 * Well, in case the cache is captured by iPad Chrome, that cache will cover all
   browses on table and desktop.
 * When I disable the mobile UA on the cache, the result is same.
    The cached by
   iPad Chrome is first on the desktop.
    -  This reply was modified 5 years, 2 months ago by [createpop](https://wordpress.org/support/users/createpop/).
    -  This reply was modified 5 years, 2 months ago by [createpop](https://wordpress.org/support/users/createpop/).
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14073918)
 * Strange… Would you provide us with a link to your page?
 *  Thread Starter [createpop](https://wordpress.org/support/users/createpop/)
 * (@createpop)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14073948)
 * Thank you for you reply.
 * The first cache is done by iPad Chrome, the caches is served on the desktop.
   
   Adversely, the single page cache is done by desktop browsers, that cache is served
   on the iPad Chrome. [https://www.adfwebmagazine.jp/](https://www.adfwebmagazine.jp/)
 * Okay, I purge all at onece.
    I think it is not strange based on my experience.
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14074078)
 * > Well, in case the cache is captured by iPad Chrome, that cache will cover all
   > browses on table and desktop.
   > When I disable the mobile UA on the cache, the result is same.
   >  The cached 
   > by iPad Chrome is first on the desktop.
 * You still didn’t describe why the cache should vary. If you use a responsive 
   theme there is no need for cache vary, because the view for each device depends
   on CSS, so there can’t be any reason why Chrome on iPad should display different
   views than on other mobile devices. Does your theme have any function to detect
   devices?
 *  Thread Starter [createpop](https://wordpress.org/support/users/createpop/)
 * (@createpop)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14074137)
 * I don’t understand your explanation well.
    I give up that I try to explain.
 *  Thread Starter [createpop](https://wordpress.org/support/users/createpop/)
 * (@createpop)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14074167)
 * I just want to know how to separate iPad including Chrome and desktop.
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14074524)
 * Chrome can be installed on iPad with Mac OS and also on Windows|Mac|Linux desktop
   devices. You must better specify your define. A desktop can be every device with
   different OS. OS matters to exactly differentiate cache vary.
 *  Thread Starter [createpop](https://wordpress.org/support/users/createpop/)
 * (@createpop)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14074536)
 * Yeah, I know.
    You should define what you want to know. Besides, I just want 
   to know how to cache sedately on iPad. Just it.
    -  This reply was modified 5 years, 2 months ago by [createpop](https://wordpress.org/support/users/createpop/).
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14074779)
 * I can define all logical|possible cache rules, but without exact information 
   I don’t waste my time with a senseless job.
 * 1.) Chrome on iPad is okay
    2.) Chrome on desktop is not okay, because Chrome
   can be installed on every device and OS. Therefore, please specify what you need.
   If you can’t, I can’t help you.
 * Anyway, every cache rule defined in .htaccess must have a copy in PHP. If it 
   isn’t defined in PHP cache varies in .htaccess don’t make any sense and will 
   not work proper. That’s why I ask you if your theme has a PHP based device detection.
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14079368)
 * Hi,
 * Unfortunately, not possible at this moment
 * the WP itself only differentiate for desktop and mobile , it doesn’t take table(
   or iPad) as 3rd device type
 * [https://developer.wordpress.org/reference/functions/wp_is_mobile/](https://developer.wordpress.org/reference/functions/wp_is_mobile/)
 * and LSCWP followed that logic
 * we are discussing a dedicated table vary , just havne’t found a good way to implement
   and make it compatible with most situations.
 * Best regards,
 *  Thread Starter [createpop](https://wordpress.org/support/users/createpop/)
 * (@createpop)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14079518)
 * Hi ｑｔｗｒｋ,
 * Thank you for your info.
    I understand it.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Cache Vary’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

 * 14 replies
 * 3 participants
 * Last reply from: [createpop](https://wordpress.org/support/users/createpop/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/cache-vary/#post-14079518)
 * Status: resolved