Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:cache:common:seperate-mobile-versions [2017/02/22 16:04]
Kevin Fwu
litespeed_wiki:cache:common:seperate-mobile-versions [2017/10/18 16:25]
Lisa Clarke Separated out verbiage for LSCWP to make it more clear.
Line 1: Line 1:
 ====== Handling Websites With Separate Mobile Versions ====== ====== Handling Websites With Separate Mobile Versions ======
  
-**UPDATE:** As of LSCWP version 1.0.4, there is a configuration option ​that will add this rule automatically. Please see the [[litespeed_wiki:​cache:​lscwp:​configuration#​enable_separate_mobile_view|configurations wiki]] for additional details.+Caching may not work properly with websites ​that have separate Mobile versions which use a different skin than the main site uses.
  
-Caching may not work properly with websites that have separate Mobile ​versions using a different skin than the main site.+In such cases, you can tell LSCache to cache a separate ​copy of the website'​s ​Mobile ​version so that the views are not mixed up.
  
-In such cases, you can tell LSCache ​to cache the website'​s Mobile ​version ​differently than the main version so they are not mixed upDo this by adding ​the following to the .htaccess file (these are just some examples only and you may have your own rules):+===== In the LSCache ​for WordPress Plugin ===== 
 + 
 +If you are using the WordPress plugin, as of version ​1.0.4, there is a configuration option that will add this rule automatically. Please see the [[litespeed_wiki:​cache:​lscwp:​configuration:​cache#​cache_mobile|LSCWP Cache Settings page]] for additional details. 
 + 
 +===== For Other LSCache Applications ===== 
 + 
 +Add the following to the ''​.htaccess'' ​file (these are just some examples only and you may have your own rules):
  
 <​code>​ <​code>​
-RewriteCond %{HTTP_USER_AGENT} android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|opera\ m(ob|in)i|palm(\ os)?​|phone|p(ixi|re)\/​|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ (ce|phone)|xda|xiino [NC,OR]+RewriteCond %{HTTP_USER_AGENT} ​"android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|opera\ m(ob|in)i|palm(\ os)?​|phone|p(ixi|re)\/​|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ (ce|phone)|xda|xiino" ​[NC]
 RewriteRule .* - [E=Cache-Control:​vary=ismobile] RewriteRule .* - [E=Cache-Control:​vary=ismobile]
 </​code> ​ </​code> ​
Line 15: Line 21:
  
 <​code>​ <​code>​
-RewriteCond %{HTTP_USER_AGENT} iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini [NC,OR]+RewriteCond %{HTTP_USER_AGENT} ​"iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini" ​[NC]
 RewriteRule .* - [E=Cache-Control:​vary=ismobile] RewriteRule .* - [E=Cache-Control:​vary=ismobile]
 </​code> ​ </​code> ​
Line 23: Line 29:
 **Important:​** Your rewrite rules must exactly match your backend'​s mobile detection. If these do not match, you may run into the issue where your rewrite rules think that a device is mobile while the backend does not and visa-versa. This can cause, for example, the desktop version of a page to be cached and flagged as the mobile version which will then be wrongly served to all mobile viewers. **Important:​** Your rewrite rules must exactly match your backend'​s mobile detection. If these do not match, you may run into the issue where your rewrite rules think that a device is mobile while the backend does not and visa-versa. This can cause, for example, the desktop version of a page to be cached and flagged as the mobile version which will then be wrongly served to all mobile viewers.
  
-For example, for Magento LiteMage ​user, once you set the above in .htaccess, you have to set the exact same expression ​at Magento administrative area -> System ​-> Configuration ​-> Design ​-> Themes ​->Add Exceptionsplace the exact same expression used in .htaccess here.  ​Otherwise, it may not return the right contents.+For example, for Magento LiteMage ​users, once you set the above in ''​.htaccess''​, you have to set the //exact same expression// in the Magento administrative area: Navigate to **System > Configuration > Design > Themes > Add Exceptions** and place the expression used in ''​.htaccess'' ​here.  ​If it's not exact, it may not return the right contents.
  • Admin
  • Last modified: 2017/10/18 16:25
  • by Lisa Clarke