We noticed today that when we typed in the domain.com for our site, rather than www.domain.com, using redirection based on url, it showed the mobile version of the site on desktops.

In our case, we corrected it by adding a redirect on our server to redirect domain.com to www.domain.com, since that was something useful anyway.

Seems like, as long as a subdomain is entered, things work as expected, but if the site visitor leaves it off, hilarity can ensue.

Maybe something buried in one of those pregs comparisons?

Members fund testing for the Drupal project. Drupal Association Learn more


YK85’s picture

I was wondering if this is still an issue. On my site I use http://example.com (no www) and about to try this module. Your advice would be really appreciated!

organicwire’s picture

Version: 6.x-1.12 » 6.x-2.3
Status: Active » Needs work
1.57 KB

I also encountered this issue. I fixed with a, as I find it, rather brutal patch. Does someone know why mobile tools thinks, the longer URL means the mobile site?

However, my patch removes the check for the longer URL. Instead it says that the default theme is the desktop theme.

minorOffense’s picture

Assigned: Unassigned » minorOffense

Yeah I'm not quite sure why it's using the longest url either. Some kind of best-guess when a setting isn't defined by default.

As for the www., best advice I can offer is to use mod_rewrite in apache to rewrite traffic going to www. to just your domain (or vice versa, have domain.com be rewritten to www.domain.com)

In Drupal 7 the sites.php file helps with this as well.

In the mean time I'll have a look at that weird logic in the code described above.