This is actually occurring for me on versions 6.x-2.x-dev and 6.x-2.2
I'm using 2 different subdomains for mobile vs desktop versions of the site:
m.mysite.com and www.mysite.com
I'm using theme switching from Mobile Tools, based on URL, with redirection for mobile users, and I'm using browscap for device detection. I've another homepage set for mobile visitors.
All of the pages work and switch correctly on m.mysite.com, except the frontpage which is not only displaying as the normal frontpage, but also in the normal theme. When I try to go to: m.mysite.com/home-mobile (my mobile version of the frontpage) directly, it redirects to m.mysite.com displaying this incorrect front page.
I have turned cacheing off completely to make sure that some cacheing was not the issue.
Thanks for looking at this!
Comments
Comment #1
ryrye commentedI should clarify:
In my description above I gave fake urls because I don't think my client would want the url out in the public yet. To be clear, in my development environment I am using two different subdomains, like:
mabc.mydomain.com
abc.mydomain.com
Would not using the normal "m" subdomain be causing this problem?
Comment #2
venusrising commentedryrye was wondering if when you are using the m.yourdomain did you need to do another drupal install or did you just point it to the regular domain (DNS wise) we are confused and wondering about this.
Comment #3
ryrye commentedHi venusrising - I didn't do another Drupal install, just pointed the subdomain for my mobile site to the same server in DNS, and then configured apache to point the mobile subdomain to the same drupal install. Its the exact same site, and Mobile Tools should be able to do the theme switching by detecting the different subdomain.
I hope that helps, let me know if you have more questions.
Comment #4
venusrising commentedryrye Would you mind sharing with what you mean bu pointing Apache to point to the mobile subdomain? Do you mean the CNAME DNS alias like
Host Name/Alias: m
Value/Destination: ourdomain.com ?
regarding your issue
Did you specify which page to direct mobile users to in the mobile tools UI at the bottom.
Did you create a custom template file for the mobile page and for the regular page?
Comment #5
venusrising commentedryrye BTW I jut noticed that I deleted the entry under specify another page for mobile users as it said specify a different one here if you want... so it was pre-filled to frontpage and when I deleted and saved it Going to my homepage it would say page could not be found. Not sure if this helps or proves anything but it seems odd. i went back in to the UI and put frontpage and the page is fine again.
If I put in there say contact the regular site directs to that page too
Comment #6
ryrye commentedSorry, I didn't explain that very well. I set up a cname record at my DNS host, and then a virtual host in Apache's settings on my server.
Regarding the issue - I've now ended up using Domain Access module to control having two separate themes depending on the url, and then some custom code to handle switching and redirecting between the two.
Comment #7
venusrising commentedryrye o
Yeah, to bad because the Mobile tools was working well for theme switching but the lack of cache is a deal breaker. been playing with the free version of mobify and while it does not offer javascript for free version it does work well otherwise. So you can set it for only some phones and leave Android or others alone if you choose.
BTW so when you say virtual host you set w a whole other virtual instance of the sub domain? Was trying to avoid that much overhead, wanted to serve up same content just in a slimmed down form.
Comment #8
twom commentedHi guys,
Renaming this post since subject has gone from the front page not working towards configuration of the subdomain.
I
Comment #9
ryrye commentedvenusrising - I didn't set up another instance of the site install for the mobile subdomain, if thats what you mean. The idea is that you configure the two subdomains to reference the same exact same code and database, but you change the way the site is presented depending on whether your client is visiting from m or www.
I don't know what your specific server environment is like, but you might find this useful if your server is running apache: http://www.linux.com/news/enterprise/systems-management/8202-how-to-set-...
Comment #10
venusrising commentedThanks will check that out. Wish mobile tools had some more documentation.
Comment #11
venusrising commentedDoes anyone know if using this with a view for the frontpage if you can style each page in its own way.
i.e views frontpage styled with panels style for desktop and maybe unformatted for mobile OR if one must create a mobile homepage separate from the regular to get a different style?
On the home desktop we have two columns for the content which obviously is bad for mobile as it looks weird.
Comment #12
Gastonia commentedVenusrising and RyRye,
I have been having a similar issue, which I posted about here: http://drupal.org/node/1152812. I have been trying my best to get two separate Drupal installs to read from the same database, but have different sub domains - www.imagineonemobile.com and mobile.imagineonemobile.com.
Are you saying all we have to do is have a cname / alias http://mobile. point to the same install as the Desktop version and Mobile Tools detects this automatically?
To the Maintainer: If you get a chance to read this. This is a great module, but the instructions leave a lot of people wondering how to set it up. I've read through all the documentation for Mobile Tools word for word several times, and I never would have ever guessed I was supposed to simply use a CNAME in my DNS. Also, RYE is talking about configuring Apache?!?! What in the world is all that about? I am, like a lot of people it seems, extremely confused how this module is supposed to be properly setup, and I wish we had clearer instructions and examples for different setups, step by step.
Thanks,
Blue
Comment #13
venusrising commentedGastonia
We have our CNAME m alias set to same desktop URL
so we get a subdomain of m.ourdomain
Yes, points to same place.
You are right really needs some documentation.
Comment #14
venusrising commentedryrye Wondering if you noticed an errors on navigation links. When clicking on footer or primary navigation we get a call to undefined function url on line 531. Have you seen this at all? We set up a seperate home for mobile so we could style the view in a simpler way. It also does not seem to matter what theme is being used. Any ideas?
BTW some links work on a different category navigation we made. Primary links like /about etc crap out
Comment #15
glarsch commentedI'm having the same issue. I've set up a CNAME as the same IP as my main site, but when i to go m.mysitename.com, all I get is a "Great Success ! Apache is working on your cPanel® and WHM™ Server"
Am I missing something? Is there more configuration besides just the CNAME?
Comment #16
Ela commentedsubscribing..
Comment #17
Elegar commentedSame thing.
I have configured my server so that mydomain.com and m.mydomain.com are the same. And I have pointed specific frontapage via settings, but there still opens frontpage from desktop version with only mobile theme.
Comment #18
glarsch commentedSo I figured this out by adding an alias (a parked domain in my cPanel config) of m.mysitename.com which pointed to the same root folder as mysitename.com. Then I theme switching was based on url, and mobile version is at m.mysitename.com and desktop is mysitename.com. I switched to Browscap from the default Mobile tools detection module as well. I don't seem to have any more problems. Hopefully that helps someone, although I'm using my standard home page with the mobile theme.
Comment #19
Gastonia commentedI'd like to propose an alternative solution to this problem. This solution doesn't use mobile tools at all. After weeks of trying to get mobile tools to work, I finally just had to do something else. My apologies to the maintainer. I think this is a great module and has a lot of potential, but, it's "just not there yet." Hopefully, this will help others as well.
Aside from not understanding how to implement mobile tools, the biggest problem mobile tools faces is that it turns off Drupal Cache. That's just not reasonable. No Drupal installation, no matter how small or how little traffic, can be expected to perform well without cache.
My original solution was to use custom PHP to detect the User Agent string, and then use header() to redirect. The problem is Drupal will extract PHP before cachine. Or, in other words, Drupal doesn't allow PHP to be in the cached files. But, it does allow Javascript. Here is what I did.
First, download Domain Access module - http://drupal.org/project/domain. Be sure to READ the installation instructions. You do have to modify your DNS (note, that this solution does work with Shared hosting.). Install domain access and configure it for the sub domains you want to represent your mobile solution. Enable theme switching in the module package.
Secondly, javascript has a user agent string detection that works great to determine. your solution will be different but here is the code for mine:
Be sure to put this outside of any document.ready functionality. It needs to execute first.
Step three, remove Mobile Tools.
With this solution you can redirect any device to whatever theme you want. And, best of all, you can still use page caching!! if you want to test it in action you can visit imagineonemobile.com with a computer or different devices.
Hope this helps someone,
Blue
Comment #20
ryrye commentedFor anyone having troubles configuring their server for a mobile site, I'd encourage you to download Domain Access module and read the extremely helpful INSTALL.txt in there to get some more background on the topic. In particular I recommend that you check out section 2.2 in the document, on Server Configuration.
If you can get Mobile Tools to work properly on your site, it will save you a lot of work because it covers so many of the features that you will want on a mobile site. Otherwise you may have to go for a more manual approach, along the lines of what Gastonia mentioned above, using Domain Access to switch themes and some code to cause redirection for mobile devices. I think it's beyond the scope of this thread (and the Mobile Tools module!) to go into details of how to use these other solutions, but an outline of the solution I found was to detect devices using Browscap and put conditional redirection code in my themes' template.php
Comment #21
venusrising commentedryrye It would be great to have further info about how you did the conditional redirect in the template.php
Does this mean that even if you do redirection by url Cache is also disabled? I thought this was only if you used the same url? am I wrong? Sure wish the docs were more clear.
Thanks for all of the replies.
Comment #22
ryrye commentedSorry venusrising I don't want to go into more details on this here, its not part of the module. I am talking about a way to get theme switching without using Mobile Tools, and since this is a place to discuss Mobile Tools that would be completely off topic.
Comment #23
Gastonia commentedI do think we should move the thread. I'll be happy to setup a forum thread when I have some free time today, but I wanted to quickly comment.
Using logic in the template file is the solution I used. In fact, my code above will work great - all you have to do is change my domains to your domains.
But, you can't use PHP to determin this logic. PHP isn't allowed in the Cache, and, if you use PHP you have to have cache turned off. Javascript is the only way to use logic and still have caching enabled.
Comment #24
venusrising commentedThe new build of Mobile Tools seems to solve many of these issues. We also made a separate mobile home page so we could tweak the output a bit more. We used views for that and it all works well when using Brwosecap
Comment #25
mgiffordThis thread is important, but seems to go all over the place. The JS above will probably work, this may work too - http://www.hedindesign.com/blog/dont-use-mobile-tools-module-drupal-go-m...
Neither allows the user to override that and switch back to the other version however.
Would be nice if there was an easy jQuery way to do this.