Issue with mobile cache in LScache plugin

mithu

New Member
#1
Hi
i am using digital ocean 8GB ram and 16GB SSD , 4 core CPU

I have installed openlitespeed and added a wodpress sites ,
The issue i have been facing is after clearing the cache when i load the site is mobile it loads good . and after tat when i load the site in desktop and load the site again in mobile i see desktop version for mobile .

I not sure whats the issue ! So bow i have added wp rocket plugin on top of lscache and activated option for separate mobile cache in wp rcoket and its works , Right now i can view desktop and mobile version sperately . So is tere any issue with mobile caching ?Or am i doing something wrong
 

mithu

New Member
#3
Hi @Shivam
Yes I have enabled mobile caching option already and did not work .
Is it anything to do with mobile detect php code which I have used in header.php to change the style of menu for mobile and desktop .
but for me I see only desktop cache for mobile . Like menu which I see for desktop is cached for mobile
 
#4
Hi @mithu

To keep the content centralized, we'll move it from the litespeed forum to here, to quote you on your litespeed forum reply:

Hi @lucasrolff
Thank you for your reply . Yes I have enabled it already . And it’s not working .
I have used this mobile detect php code for changing the style of menu when it’s mobile and desktop . Is it anything to do with that .
And added tat code in header.php
This mobile detection script how does that look?

Additionally, can you check in your .htaccess file in the root of your WordPress installation, whether it contains the lines:


Apache config:
### marker MOBILE start ###
RewriteCond %{HTTP_USER_AGENT} Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]
### marker MOBILE end ###
If it does, please try and restart the openlitespeed web server
 

mithu

New Member
#8
Hi @mithu

To keep the content centralized, we'll move it from the litespeed forum to here, to quote you on your litespeed forum reply:



This mobile detection script how does that look?

Additionally, can you check in your .htaccess file in the root of your WordPress installation, whether it contains the lines:


Apache config:
### marker MOBILE start ###
RewriteCond %{HTTP_USER_AGENT} Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]
### marker MOBILE end ###
If it does, please try and restart the openlitespeed web server
Hi @lucasrolff
Thank you for your reply again .

This is the mobile detect php code i have been using in header.php for changing menu style by mobile and desktop

PHP:
<?php
    require_once 'Mobile_Detect.php';
    $detect = new Mobile_Detect;
?>

<?php
/****************** Mobile View *********************/
    if ( $detect->isMobile() || $detect->isTablet() )
    {
?>
<!---------------- Mobile Menu Comes here ----------------->
<?php } else { ?>
<!---------------- Deskop Menu Comes here ----------------->
<?php } ?>
And this in my .htaccess

Code:
### marker MOBILE start ###
RewriteCond %{HTTP_USER_AGENT} Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi [NC]
RewriteRule .* - [E=Cache-Control:vary=ismobile]
### marker MOBILE end ###
Looking forward to your views on it .
Thank you buddy :)
 
#9
@mithu,

Okay, so in that case 'vary=ismobile' should be set for mobile user agents, and I suspect that it's because OpenLiteSpeed still look at old rewrite rules, this can be fixed by restarting OpenLiteSpeed and then possibly clear the cache afterwards just to be sure

If it doesn't work, then please open a ticket with us at support (a) litespeedtech.com - this way we can get access to your server, and investigate a bit further to see if it's something within OpenLiteSpeed or the LiteSpeed plugin that doesn't function as it should, or possibly a small configuration error
 
Top