I'm hosting a website which is still under construction, I was trying to make a copy of my production site and build a test-site on my local host. I copied the files to my new web root on local host and imported the database file, i tried to visit the home page via http://127.0.0.1, but i was redirected to my production site: www.samplesite.com every time i visit the local host home page, i will be redirected to the site, can not access the pages and change any local site settings.
Finally, i find the problem was caused by Mobile Tools, because I've set the Mobile URL & Desktop URL in General Configuration page of Mobile Tools. I set www.samplesite.com for Desktop URL, that's why i will be redirected.
I moved Mobile Tools folder from the modules folder to another folder, then the local host home page is available, i cleared system cache and modified the Desktop URL, then move the folder back, everything comes back and runs well.
So, i think this is a bug for Mobile Tools, and the BaseURL should be retrieved for the Desktop URL from the system setting variables.
Comments
Comment #1
bostonclimber commentedI've encountered the same issue. When I set up a test server, it's a local host (named localhost, or an ip like 192.168.1.100). But I need to put a real URL for the live server. I'd like to ask Mobile Tools users;
1. How are you managing the test (local) host and the live server? If I simply update the database (using Backup and Migrate), the live server will get localhost as my Desktop URL, and never be able to get it back.
2. How are you managing multiple sites under 'sites' folder? For the real server, there would be www.samplesite.com (for desktop) and m.samplesites.com (for mobile). But for the test (local) host, how do you name the site? I'm using 'localhost' and '192.168.1.100' for the URLs, I don't need to set up any folder under 'sites' folder. That way, I can switch theme based on the URL. Obviously, localhost and 192.168.1.100 combination won't work for the live server.
I find Mobile Tools is a great module, and only if I figure out how to manage live and test server, I can use it for my website.
Comment #2
chrisal commentedI've encountered the same difficulty in version 2.2 with the following configuration :
www.samplesite.com for my production site
m.samplesite.com for the mobile site
develop.samplesite.com for the test site with its dedicated database.
(Periodicaly the development database is refreshed with the content of production database)
When I try to use my test site, I'm redirected to the production site; the workaround was to delete "mobile tools" module from the test site.
I think "mobile tools" should accept an "escape site" when not "www" or "m" sites.
Comment #3
dawsonit commentedWe are hitting the same problem, but ours comes from using a separate hostname for the https version of our site.
We have the following hostnames in use:
m.example.com for mobile
www.example.com for desktop
secure.example.com for ssl
Using ANY hostname except the 2 specified in the config fails (redirects to desktop url). This is particularly problematic for an ssl site, as the whole point of security is thwarted by mobile tools when we are redirected to the plain http desktop url. I've worked around it temporarily by causing the redirect function, and the theme switching function to exit when they detect the https protocol. However, it seems odd that users are locked into using the desktop url only. Is there a use case that requires all hostnames to be routed to the one desktop url? Is there some logic in the code that prevents desktop users from using alternate hostnames on a mobile-tools enabled site?
Comment #4
ryan osītis commentedSubscribe
Comment #5
Anonymous (not verified) commentedsame
Comment #6
minoroffense commentedMobile Tools can't make assumptions about which URL is used for Desktop vs mobile. The base url may in fact be the mobile URL for the site.
If you know ahead of time the URL of your production site, I would recommend using your hosts file to capture the domain request and redirect to your local server. Another option would be to use mod_rewrite to capture your dev URL and rewrite to your production URL. That way Drupal only ever sees the prod URL and you can use something like dev.example.com to reach your site.
Beyond that, I don't think there's anything Mobile Tools can do to resolve this.
Comment #7
bdornbush commentedI ran into this problem also, and solved it using drush.
drush variable-set mobile_tools_desktop_url "http://dev.mysite.com"
drush variable-set mobile_tools_mobile_url "http://dm.mysite.com"
If I didn't have drush, I could have edited the database variable table directly.