Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
litespeed_wiki:cache:litemage:seperate-mobile-versions-magento [2019/07/10 18:07] Jackson Zhang |
litespeed_wiki:cache:litemage:seperate-mobile-versions-magento [2019/07/10 18:16] Jackson Zhang |
||
---|---|---|---|
Line 19: | Line 19: | ||
<code> | <code> | ||
+ | <IfModule LiteSpeed> | ||
+ | RewriteEngine on | ||
RewriteCond %{HTTP_USER_AGENT} "iPhone|iPod|BlackBerry|Palm|Mobile|Opera Mini|Fennec|Windows Phone" | RewriteCond %{HTTP_USER_AGENT} "iPhone|iPod|BlackBerry|Palm|Mobile|Opera Mini|Fennec|Windows Phone" | ||
RewriteRule .* - [E=Cache-Control:vary=ismobile] | RewriteRule .* - [E=Cache-Control:vary=ismobile] | ||
+ | </IfModule> | ||
</code> | </code> | ||
Line 37: | Line 40: | ||
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 LiteMage. What's wrong with it? | 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 LiteMage. What's wrong with it? | ||
+ | <IfModule Litespeed> | ||
RewriteEngine on | RewriteEngine on | ||
RewriteCond %{HTTP_USER_AGENT} "android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|iP(hone|od)|iris|kindle|lge |maemo|meego.+mobile|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|(Android.+Mobile)|NOKIA|SymbianOS|N900|BlackBerry" | RewriteCond %{HTTP_USER_AGENT} "android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|iP(hone|od)|iris|kindle|lge |maemo|meego.+mobile|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|(Android.+Mobile)|NOKIA|SymbianOS|N900|BlackBerry" | ||
RewriteRule .* - [E=Cache-Control:vary=ismobile] | RewriteRule .* - [E=Cache-Control:vary=ismobile] | ||
+ | </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. | 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. | ||
<code> | <code> | ||
+ | <IfModule Litespeed> | ||
+ | LiteMage on | ||
RewriteEngine on | RewriteEngine on | ||
RewriteCond %{HTTP_USER_AGENT} "android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|iP(hone|od)|iris|kindle|lge |maemo|meego.+mobile|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|(Android.+Mobile)|NOKIA|SymbianOS|N900|BlackBerry" | RewriteCond %{HTTP_USER_AGENT} "android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|iP(hone|od)|iris|kindle|lge |maemo|meego.+mobile|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|(Android.+Mobile)|NOKIA|SymbianOS|N900|BlackBerry" | ||
RewriteRule .* - [E=Cache-Control:vary=ismobile] | RewriteRule .* - [E=Cache-Control:vary=ismobile] | ||
+ | </IfModule> | ||
############################################ | ############################################ | ||
Line 285: | Line 292: | ||
</Files> | </Files> | ||
- | <IfModule Litespeed> | ||
- | LiteMage on | ||
- | </IfModule> | ||
</code> | </code> |