Wordpress LScache Plugin: Mobile & Desktop issue ? force link does not work
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hi, I am using Any Mobile Theme Switcher to serve mobile layout for mobile visitors. I have activated AMP in LSCache plugin and my .htaccess looks like this: RewriteCond % HTTP_USER_AGENT Mobile|Android|Silk/|Kindle|BlackBerry|Opera Mini|Opera Mobi|iPhone|iPod|iPad|Palm Os|Googlebot -Mobile|mobile|mobi|Windows Mobile|Safari Mobile [NC] RewriteRule . ? [E=Cache-Control:vary=ismobile] I believe this is working fine for desktops and mobile. The problem shows when I want to force mobile or force desktop on one of the devices. Any Mobile Theme Switcher allows to force desktop theme on mobile by adding parameter to URL: ?am_force_theme_layout=desktop and ?am_force_theme_layout=mobile for the opposite ? the thing is that if I have loaded a page with mobile theme, LSCache will serve me mobile theme no matter if I have chosen to see desktop version by clicking the link Is there any solution for this? Regards, orsz I forgot to mention, but its probably relevant: After I forced theme, visitor is redirected to the URL without parameter. So if page URL on mobile device was for instance: https://domain.com/page (mobile) I clicked force destkop : https://domain.com/page?am_force_theme_layout=desktop I see mobile version again at: https://domain.com/page (should be desktop now) but then if I go to other page with my mobile, it has been changed to desktop correctly: https://domain.com/page2 (desktop) but if I force mobile again here: https://domain.com/page2?am_force_theme_layout=mobile it shows desktop version anyway?.. (hope it clarifies the situation) Same problem is with currencies. I change currency via parameter cur ?cur=EUR ?cur=USD and then redirect to page without parameter: https://domain.com/product (default EUR) https://domain.com/product?cur=USD (should change to USD and redirect back) https://domain.com/product (shows EUR instead of USD) but if page has already been loaded with one currency, its impossible to change it (or at least refresh the view) Hi @orszer , For the Mobile/Desktop Issue with Query String, I believe it is the plugins feature to redirect to the Actual URL without Query String. However, when the request gets there, Litespeed recognizes the device by its User-Agent as it is told and serves the relevant cached copy, which is correct behaviour as per the current setup. Do you know if Any Mobile Theme Switcher and/or Your Currency Plugin adds cookies to the browser when you access that query string? If so, You can first put those Query Strings to no-cache ? https://docs.litespeedtech.com/lscache/lscwp/cache/#do-not-cache-query-strings And then utilize Cache Vary by Cookies to correct this behaviour(Put the Rules above Mobile Cache Rules in .htaccess) ? https://docs.litespeedtech.com/lscache/lscwp/admin/#configuring-a-cookie-cache-vary This way, Your Query Strings will always set the correct cookie in the browser, and when the request gets redirected to the main page(without Query String), LSCWP will be able to detect the cookie in the browser to show the correct page. Best Regards Hi Shivam, Your solution worked just fine! Thanks. Cheers!
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference