WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] User Agent Groups Settings (10 posts)

  1. sysopsavant
    Member
    Posted 3 years ago #

    I've been attempting to use various mobile plugins to make our site mobile friendly. I just discovered that by setting up the user agents and installing the Carrington Mobile theme, I can avoid using any plugin and still make the site display pretty well in a mobile theme based on the user agent string. Is there an extensive list of agents I should be using to cover as many mobile devices as possible?

  2. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

    The plugin already ships with most of the high and low level user agents strings for mobile ready.

  3. sysopsavant
    Member
    Posted 3 years ago #

    For some reason both fields were blank in mine. I reset defaults and got them back. I noticed that I can only set the mobile theme for one group. Which group should I be setting to the Carrington mobile theme? Right now I have the high group set to this. I am testing in firefox with User Agent Switcher and Modify Headers plugin set up to emulate an HTC Legend. So far it seems to pick up the theme change just fine, but I don't have a large array of phones to test it on. I'm mainly concerned with smart phones as I don't think many people with a regular cell phone will be trying to visit the site with it.

    Thanks for the help.
    Site is: http://www.morrispaint.com
    for reference.

  4. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

    Smart phones are the "high" group.

  5. sysopsavant
    Member
    Posted 3 years ago #

    Thanks for the help.

  6. Damon Cook
    Member
    Posted 3 years ago #

    to continue this conversation... I've gone through similar steps in testing mobile plugins (mainly Wp-touch and their compatibility with W3 Total Cache and found that not using WP-Touch at all is easier, however I don't want to use Carrington Mobile, but want to use my own site...basically redirect users to a subdirectory site mysite.com/mobile/ I find that when I use the "Redirect Users to..." field in the User Agent area of the W3 Total Cache plugin to try and redirect users to mysite.com/mobile/ I get a "Safari cannot open this page because too many redirects occur." on my iPhone. Suggestions?

    Here are my rewrite conditions in my .htaccess file generated by W3 Total Cache:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_USER_AGENT} (240x320|2\.0\ mmp|alcatel|amoi|asus|au\-mic|audiovox|avantgo|benq|bird|blackberry|blazer|cdm|cellphone|danger|ddipocket|docomo|dopod|elaine/3\.0|ericsson|eudoraweb|fly|haier|hiptop|hp\.ipaq|htc|huawei|i\-mobile|iemobile|j\-phone|kddi|konka|kwc|kyocera/wx310k|lenovo|lg|lg/u990|lge\ vx|midp|midp\-2\.0|mmef20|mmp|mobilephone|mot\-v|motorola|netfront|newgen|newt|nintendo\ ds|nintendo\ wii|nitro|nokia|novarra|o2|openweb|opera\ mobi|opera\.mobi|palm|panasonic|pantech|pdxgw|pg|philips|phone|playstation\ portable|portalmmm|ppc|proxinet|psp|pt|qtek|sagem|samsung|sanyo|sch|sec|sendo|sgh|sharp|sharp\-tq\-gx10|small|smartphone|softbank|sonyericsson|sph|symbian|symbian\ os|symbianos|toshiba|treo|ts21i\-10|up\.browser|up\.link|uts|vertu|vodafone|wap|willcome|windows\ ce|windows\.ce|winwap|xda|zte) [NC]
    RewriteRule .* - [E=W3TC_UA:_low]
    RewriteCond %{HTTPS} =on
    RewriteRule .* - [E=W3TC_SSL:_ssl]
    RewriteCond %{SERVER_PORT} =443
    RewriteRule .* - [E=W3TC_SSL:_ssl]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule .* - [E=W3TC_ENC:.gzip]
    RewriteCond %{HTTP_USER_AGENT} (acer\\\ s100|android|archos5|blackberry9500|blackberry9530|blackberry9550|cupcake|docomo\\\ ht\\\-03a|dream|htc\\\ hero|htc\\\ magic|htc_dream|htc_magic|incognito|ipad|iphone|ipod|lg\\\-gw620|liquid\\\ build|maemo|mot\\\-mb200|mot\\\-mb300|nexus\\\ one|opera\\\ mini|samsung\\\-s8000|series60\.\*webkit|series60/5\\\.0|sonyericssone10|sonyericssonu20|sonyericssonx10|t\\\-mobile\\\ mytouch\\\ 3g|t\\\-mobile\\\ opal|tattoo|webmate|webos) [NC]
    RewriteRule .* /mobile/ [R,L]
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{REQUEST_URI} \/$
    RewriteCond %{REQUEST_URI} !(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|wp-.*\.php|index\.php) [NC,OR]
    RewriteCond %{REQUEST_URI} (wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php) [NC]
    RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|wordpress_\[a\-f0\-9\]\+|wordpress_logged_in) [NC]
    RewriteCond "mysite.com/www/wp-content/w3tc/pgcache/$1/_index%{ENV:W3TC_UA}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" -f
    RewriteRule (.*) "/wp-content/w3tc/pgcache/$1/_index%{ENV:W3TC_UA}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" [L]
    </IfModule>

  7. Damon Cook
    Member
    Posted 3 years ago #

    well, as an update I've found a work-around that works for me, but it might be worthwhile to still get some feedback if it helps us snag a bug if there is one. My solution was to make my /mobile/ sub-directory into a WP theme, which I can then set the User Agent Group Theme option to direct to and not have to use the User Agent Group Redirect option. This seems to work nicely.

  8. sysopsavant
    Member
    Posted 3 years ago #

    Did you try setting up an actual subdomain?

    http://mob.mysite.com for example which does a single redirect to your actual folder mysite.com/mobile

    I tested this on ours but I did not have a real iPhone to test with. I was using User Agent switching in Firefox.

  9. Damon Cook
    Member
    Posted 3 years ago #

    no I did not try sub-domain, and it would of been my preference, but I don't have the option to create a sub-domain on my client's service. I don't see why sub-directory wouldn't work though?

  10. sysopsavant
    Member
    Posted 3 years ago #

    It should. Mine worked fine that way when I first tested it. It really sounds like it is a browser issue. Safari may limit the number of redirections by default. This is generally to keep malicious sites from constantly redirecting your browser. I have Firefox manually set to allow only one redirection on my home computer. I did test my sub-domain this way with no issues.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic