Its a neat module, lot of promise but lack of documentation making it tedious to configure it correctly. I have read the entire issue queue and still couldn't succeed in getting the redirection to work. My setup is as follows
I have two subdomains for my test site
http://potli.sastratechnologies.biz - PC Site
http://potlim.sastratechnologies.biz - Mobile Site
Both these have been configured as VHOSTS on the same machine. These sites have separate drupal install (it is not a multisite drupal install). Both these sites have the same responsive theme i.e. the same theme has been installed in the respective sites/all/themes folder.
http://potli.sastratechnologies.biz under /home/potliweb
http://potlim.sastratechnologies.biz under /home/potlimobi
My objective is to redirect visitors with visiting the site http://potli.sastratechnologies.biz using handhelds to the http://potlim.sastratechnologies.biz - Mobile Site. To do this this is what I have done.
Installed the latest versions of the recommended modules
purl 7.x-1.0-beta1+11-dev
ctools 7.x-1.2+7-dev
context 7.x-3.0-beta5
themekey 7.x-2.3+13-dev
browscap 7.x-2.0
Then I got this error
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'b.parent' in 'field list': SELECT b.parent AS parent FROM {browscap} b GROUP BY parent ORDER BY parent ASC; Array ( ) in mobile_tools_browscap_get_browscap_parents() (line 139 of /home/ozonesco/public_html/clients/epm/sites/all/modules/mobile_tools/mobile_tools_browscap/mobile_tools_browscap.module).
I uninstalled the ctools module that I had and installed the latest dev version of ctools and then the two patches mentioned in node/1860936. I was able to view the edit "Device Groups" page. My settings now look like this
Browscap - User Agent Detection Settings
-------------------------------------------------------
Current browscap data version : 5016
[^] Enable automatic updates
Check for new user agent detection information every : 1 week
Persistent URL
------------------
-------------------------------------------------------------------------------------------------
|PROVIDER | MODIFIER TYPE | SETTINGS |
-------------------------------------------------------------------------------------------------
|Device Group | Subdomain | I don't see any link to settings here|
-------------------------------------------------------------------------------------------------
|Skip Redirect | Subdomain | I don't see any link to settings here|
-------------------------------------------------------------------------------------------------
Default domain
http://potli.sastratechnologies.biz
Device Group
-------------------
(For the device group I modified the supplied device group and chose the appropriate browser signatures)
Device Group Name : Mobile Machine name:mobile
URL Modifier : http://potlim.sastratechnologies.biz
Device detection : Browscap
Browscap
Select parent browser agents for this group
Android Browser 3.0
Android Browser 4.0
Select user agents for this group
Mozilla/5.0 (%Android%Linux%arm%Mobile%rv:10.%)%Gecko/10.%Firefox/10.%Fennec/10.%
Mozilla/5.0 (%Linux%) AppleWebKit% (KHTMK, like Gecko) %Version/4. % Safari/%
weight : 1
Http Headers
(Blank)
Mobile Tools Settings
-------------------------------
[ ] Enable entity build modes
[^] Enable device redirection
Redirection Type
(o) Server Side
( ) Client Side
[ ] Automatic redirection <-- Disabled
HTTP Headers
(Blank)
After having done all this when I visit the url http://potli.sastratechnologies.biz using the Galaxy Tab I get a
Web page not available
The web page at http://potli.sastratechnologies.biz/mobile/potlim/mobile/potlim/mobile/p... might be temporarily down....
I am not sure why the browser is being redirected to the above url. I have read some posts in the issue queue that asks for changes to be made in settings.php, changes to CNAME, change to httpd.conf. I frankly don't see a reason to do this since the redirection should be accomplished by mobile_tools nevertheless. Is there any configuration options that I have missed?
Comments
Comment #1
sridharpandu CreditAttribution: sridharpandu commentedAfter some trial I have noticed that the "Sample Device Group" is causing the the word "mobile" to be appended to the url of the PC site. So I tried deleting this but I don't seem to have an option. I diabled browser detection but the device group seems to be active. Reverting it causes the browser to report a multiple redirect issue. Anyone out there knows how to do this.
I went ahead and created a new device group with the following settings
Device group Name : Potlim machine name : potlim
URL Modifier : potlim.sastratechnologies.biz
Device detection : browscap
Browscap
Select parent browser agents for this group
Android Browser 3.0
Android Browser 4.0
Select user agents for this group
Mozilla/5.0 (%Android%Linux%arm%Mobile%rv:10.%)%Gecko/10.%Firefox/10.%Fennec/10.%
Mozilla/5.0 (%Linux%) AppleWebKit% (KHTMK, like Gecko) %Version/4. % Safari/%
weight 0
Http Headers
(Blank)
I now get the error The requested page /potlim.sastratechnologies.biz/mobile//potlim.sastratechnologies.biz/mobile//potlim.sastratechnologies.biz/mobile//potlim.sastratechnologies.biz/mobile//potlim.sastratechnologies.biz/mobile//potlim.sastratechnologies.biz/mobile/potlim.sastratechnologies.biz/mobile//potlim.sastratechnologies.biz/mobile//potlim.sastratechnologies.biz/mobile/potlim/mobile/potlim/mobile/potlim/mobile/potlim/mobile/potlim/mobile/potlim/mobile/potlim/mobile/potlim/mobile/potlim/null could not be found.
Comment #2
sridharpandu CreditAttribution: sridharpandu commentedI knocked off the "Sample Device Group" record from the table using
delete from mobile_tools_device_group where dgid = 'mobile';
now when I access the site the message I get is
Page Not found
/http%3A//potlim.sastratechnologies.biz could not be found
Getting interesting by the minute. Now I am wondering where did the leading slash come from? Any ideas?
Comment #3
sridharpandu CreditAttribution: sridharpandu commentedIs there a function in mobile_tools to identify if the device is mobile? I should be able to perform a redirect in a custom module if I get a function that can tell me if the device accessing ths site is a mobile.
Comment #4
sridharpandu CreditAttribution: sridharpandu commentedI patched the module to force a redirect. The redirection happens correctly on all devices except on iPad and iPhone. I am trying to figure out a way to detect and redirect the iphone and iPad.
My iPhone 4 has a device signature (taken from the apache access logs) which looks like this
"Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523 Safari/8536.25"
I have chosen the following user agent string in Mobile tools configuration
Mozilla/5.0 (iPhone%CPU%OS 6_0% like Mac OS X%)%AppleWebKit/%(%KHTML, like Gecko%)%Version/6.0 %Mobile/%Safari/%
But redirect doesn't happen. :-(
Comment #5
sridharpandu CreditAttribution: sridharpandu commentedHowever strange this may seem, if I create a separate device group for iPhone the redirection happens. But when I combine the iPhone device with the others, I have Blackberry, Android, Symbian in another group, The redirection doesn't happen.
Comment #6
sridharpandu CreditAttribution: sridharpandu commentedIf the pages are cached then redirection doesn't happen. Is there a way to bypass Drupal Cache or Boost?
Comment #7
suresh7787 CreditAttribution: suresh7787 commented1.http://www.eldeto.com/simple-apache-configuration-file-mobile-device-det.... Helps to configure your Boost and Apache for device detection or
2. Install the AMF(Apache Mobile Filter)into your server and configure it. For that Kinldy check this link
http://www.apachemobilefilter.org/
Comment #8
sridharpandu CreditAttribution: sridharpandu commentedBy the way I have written a small JS snippet to accomplish redirection. Works for me. Sufficient for the current assignment. But yes AMF is something I am watching.