Is there a way to only redirect the homepage and not subpages to a mobile site? I have a small mobile site so many of my pages do not have mobile equivalents. I've been able to setup the module so it lists all the directories without mobile equivalents as exceptions not to redirect, but I figured settting it up so that only the homepage is redirected would be easier.
I saw that I can check off "Do only redirect from the following pages", but am not sure what to put for the homepage. Is it ? Also, when I checked that off and added a few directories to redirect, it was still redirecting pages not in the list.
Comment | File | Size | Author |
---|---|---|---|
#11 | redirect_only_on_homepage-707484-11.patch | 3.03 KB | Devin Carlson |
#5 | redirect_only_on_homepage-707484-4.patch | 735 bytes | organicwire |
Comments
Comment #1
larryhackman CreditAttribution: larryhackman commentedI too have the same exact problem. Using / as the only redirect page seemed not to do the trick.
Specifically, I am not redirecting to a subdomain, only to a new page, so for example www.example.com/mobile instead of mobile.example.com. But mobile tools will send anything to www.example.com/mobile/whatever and I get nasty 404 pages. But all I want is a different homepage.
Would be interested in a solution...
Comment #2
larryhackman CreditAttribution: larryhackman commentedFound a solution! jwbuzz found a typo in mobile_tools.module and replaced one line (434, though it was different in Coda...) with this:
if (isset($_GET['q']) && variable_get('mobile_tools_redirect_exceptions_type', 0) == 'only-redirect') {
This totally did the trick for me.
You can see his work here.
Comment #3
mbiddlecombe CreditAttribution: mbiddlecombe commenteddo you still have / in the exceptions box? can't seem to get this fix to work for me.
Comment #4
organicwire CreditAttribution: organicwire commentedI also encountered this bug. What I need is that a redirection is done only when the browser hits the frontpage.
I tried to solve this by configuring mobile tools like this:
As I understand the mobile_tools code, these settings are ignored if there's no q parameter in $_GET. In other words, the abovementioned settings are not taking into account if the browser hits the front page.
I was able to fix this: a condition in mobile_tools_device_redirect() needs to be removed:
if (isset($_GET['q'] && ...)
.Please review my fix, following in a minute or so.
Comment #5
organicwire CreditAttribution: organicwire commentedComment #6
organicwire CreditAttribution: organicwire commentedComment #7
TelFiRE CreditAttribution: TelFiRE commentedHey um, doesn't this need to be applied to the hosted module? Because to me it seems like that's a pretty critical bug, I mean the single most important purpose of a tool like this would be to redirect the home page and you can't. I am pretty surprised it's not fixed by now :/
I do appreciate the patch though, worked like a charm. Why not just commit?
also verbiage suggestion:
"Give the paths to pages that should not be redirected. Put each path on a seperate line. The '*' character is a wildcard."
"Pages that should/should not be redirected. Place each path on a seperate line. '*' is a wildcard and '<front>' can be used for the home page."
Comment #8
hwasem CreditAttribution: hwasem commentedI downloaded the module yesterday and came across the problem with trying to only redirect my homepage. The patch in #5 worked for me, as well.
Great module and I look forward to hearing about the updated release so I can deploy on my production site!
Thanks!
Comment #9
todea CreditAttribution: todea commentedI also need to be able to redirect my homepage only. The patch in #5 worked for me. Not sure if there was a problem with my setup but I had to manually apply the patch.
Comment #10
yashadev CreditAttribution: yashadev commentedComment #11
Devin Carlson CreditAttribution: Devin Carlson commentedAn updated patch against 6.x-2.x for testing.
Comment #12
Devin Carlson CreditAttribution: Devin Carlson commentedMarked #1063122: When using different homepage for mobile, desktop hompage changes too as a duplicate.
Comment #13
memcinto CreditAttribution: memcinto commentedThis patch (the one in #11) made my site whitescreen (thankfully a test site). I used drush to clear cache and run cron, still whitescreening. I tried to disable the module using drush, drush threw up:
drush dis mobile_tools
The following extensions will be disabled: mobile_tools, mobile_tools_roles
Do you really want to continue? (y/n): y
WD file system: The directory sites/ahsl.arizona.edu/files/images is not writable, because it [error]
does not have the correct permissions set.
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /htdocs/drupal/drupal-6.19/sites/all/modules/ctools/includes/export-ui.inc on line 270
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in
/htdocs/drupal/drupal-6.19/sites/all/modules/ctools/includes/export-ui.inc, line 270
The site was majorly messed up with out-of-memory errors. Most admin pages would whitescreen. I couldn't get to the modules page to disable things and I couldn't use drush to disable things. I removed the mobile tools module at the file layer and that didn't fix it. I put an unpatched version of mobile tools in place and that didn't fix it. It looked like from what I *could* see, as though every module on the site was enabled - no wonder the poor thing was out of memory! I could not fix it, and finally overwrote the database with a dump from the production site - that fixed it, of course.
I then applied the patch in #5 and that temporarily fixed the homepage redirecting problem - until it stopped fixing it.
Comment #14
Devin Carlson CreditAttribution: Devin Carlson commentedMarked #1653182: redirection not working in 6.x-2.4 as a duplicate.
Comment #15
organicwire CreditAttribution: organicwire commentedAre there any news about the patches in #5 and #11? Did they go into the module?
Cheers
Comment #16
hwasem CreditAttribution: hwasem commentedPatch #5 worked for me, as well. I had to reapply that patch with the upgrade to the latest Mobile Tools 6.x-2.7 in order to have redirection work. Although the lines of code to patch changed from 267 to 251.
Comment #17
organicwire CreditAttribution: organicwire commentedPatch #5 seems to be solidly tested. Let's take it into the module.
Comment #18
Devin Carlson CreditAttribution: Devin Carlson commentedCommitted #5 to 6.x-2.x.