Differences

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

Link to this comparison view

Both sides previous revision Previous revision
litespeed_wiki:cache:litemage:seperate-mobile-versions-magento [2019/07/10 18:16]
Jackson Zhang
litespeed_wiki:cache:litemage:seperate-mobile-versions-magento [2019/07/10 19:24] (current)
Lisa Clarke Copyediting
Line 9: Line 9:
   -Click on the **Add Exceptions** buttons beside the **Templates**,​ **Skin** and **Layout** labels. ​   -Click on the **Add Exceptions** buttons beside the **Templates**,​ **Skin** and **Layout** labels. ​
   -In the **Value** fields enter the name of your installed mobile theme.   -In the **Value** fields enter the name of your installed mobile theme.
-  -Enter the following line in the **Matched Expression** fields: +  -Enter the following line in the **Matched Expression** fields: ​<​code>​iPhone|iPod|BlackBerry|Palm|Mobile|Opera Mini|Fennec|Windows Phone</​code>​
- +
-  ​iPhone|iPod|BlackBerry|Palm|Mobile|Opera Mini|Fennec|Windows Phone+
  
 Like so:  ​ Like so:  ​
Line 26: Line 24:
 </​code> ​ </​code> ​
  
-**Note1:** Don't add ''​[NC]''​ to the end of ''​RewriteCond''​ since in Magento code, the design exception is a regular expression match and is case sensitive. ​+===== Important Notes =====
  
-**Note2:** The above rule must be placed ​on the very top of the .htaccess to avoid other rules stopping its execution. +  ​Don't add ''​[NC]''​ to the end of ''​RewriteCond''​ since in Magento code, the design exception is a regular expression match and is case sensitive.  
- +  ​* The above rule must be placed ​at the very top of the .htaccess ​file to avoid other rules stopping its execution. 
-**Important:​** Your rewrite rules must //exactly match// your backend'​s mobile detection (i.e. the string you entered in Step 5 above). If these do not match, your rewrite rules may think that a device is mobile while the backend does not (and vice-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.+  * Your rewrite rules must //exactly match// your backend'​s mobile detection (i.e. the string you entered in Step 5 above). If these do not match, your rewrite rules may think that a device is mobile while the backend does not (and vice-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.
  
 ====== Troubleshooting ====== ====== Troubleshooting ======
-===== Case 1:​Rewrite ​rules should be placed ​at the top of the .htaccess ​=====+===== Desktop Version Showing on Mobile ===== 
 +This case illustrates the importance of placing rewrite ​rules at the top of the .htaccess ​file.
  
-The user has set up mobile view at Magento 1.8 backend ​as the following ​and mobile view is working fine.+Let's say you'​ve ​set up mobile view in the Magento 1.8 backend, like so, and have verified that the mobile view is working fine.
 {{ :​litespeed_wiki:​cache:​litemage:​magento1-mobileview-case.png?​nolink&​800 |}} {{ :​litespeed_wiki:​cache:​litemage:​magento1-mobileview-case.png?​nolink&​800 |}}
  
-After enabling LiteMage, ​the user setup rewrite rules in .htaccess ​with exact matching ​string ​with above Magento backend setup, ​however, desktop version is still showing on mobile ​with LiteMageWhat's wrong with it?+After enabling LiteMage, ​you add rewrite rules to the bottom of your .htaccess ​file, and use the exact same user agent string ​that you used above in the Magento backend setup. Howeverwith LiteMage enabledthe desktop version is showing on mobile. ​Why?
  
   <​IfModule Litespeed>​   <​IfModule Litespeed>​
Line 46: Line 45:
    </​IfModule>​    </​IfModule>​
        
-By further checking the full .htaccess file, the above rules have been added to the end of .htaccess. ​ Other rules like ''​RewriteRule .* index.php [L]'' ​stopped ​the cache rules being executed. ​ The cache rule should be always placed on the very top of the .htaccess. ​After the rules relocated ​to the top, everything ​is working fine now.+**The above rules should ​have been added to the beginning ​of .htaccess.** Other ruleslike ''​RewriteRule .* index.php [L]''​, stop the cache rules from being executed. ​Cache rules should be //always// be placed on the very top of the .htaccess ​file 
 + 
 +Relocate ​the rules to the top, like so, and everything ​works:
  
 <​code>​ <​code>​
  • Admin
  • Last modified: 2019/07/10 19:24
  • by Lisa Clarke