Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#2 | mobile_tools_redirect_default_is_not_desktop.patch | 1.57 KB | organicwire |
Comments
Comment #1
YK85 CreditAttribution: YK85 commentedI 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!
Comment #2
organicwire CreditAttribution: organicwire commentedI 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.
Comment #3
minorOffense CreditAttribution: minorOffense commentedYeah 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.