This is an old revision of the document!


Handling Websites With Separate Mobile Versions

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 the website's Mobile version differently than the main version so they are not mixed up. Do this by adding the following to the .htaccess file:

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]
RewriteRule .* - [E=Cache-Control:vary=ismobile]

This feature is supported as of LSWS version 5.0.7.

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.

  • Admin
  • Last modified: 2016/03/23 19:01
  • by Michael Alegre