Hi,

Hope someone can help me...

I do have a site running the domain access with multiple (sub)domains, now i did make a separate mobile site http://m.websitename.nl.

When i enable "Enable automatic redirection of the mobile user" it's working great for the mobile device. When i visit the site on www.websitename.nl with a regular browser it's going ok but when i visit location.websitename.nl i get redirected to www.websitename.nl...

Any ideas?

Cheers
Henk

Comments

bzsim’s picture

We are having the same issue. We have Domain Access installed and when you visit the subdomain, you get redirected to the main website. Anyone looking into this?

slowflyer’s picture

Title: Mobile tools & Domain access module (mobile site per domain - possible solution?) » Mobile tools & Domain access module
Version: 6.x-2.x-dev » 6.x-2.1
Category: support » bug
Priority: Normal » Major

subscribe

nonsie’s picture

Out of curiosity how are your domains set up? is the m.example.com a new domain or a domain alias? is there a m.sub.example.com for each subdomain?

henkit’s picture

I use domein alias for the domains (creating domain pointers in dierct admin)

Sorry for the late Reply

Henk

nonsie’s picture

This is how I got it to work in my case (there's only a single mobile site for the default domain which is used for mobile users of any other subdomain):
1. add your mobile domain name to httpd.conf (needs to be alias of your default domain) or use control panel to add it (let's call it m.example.com)
2. enable Domain Alias
3. add your mobile domain as an alias for your default domain (eg m.example.com is an alias of example.com without redirect)
4. in Mobile Tools settings set mobile url to m.example.com and make sure desktop url is set to example.com. Check "Enable automatic redirection of the mobile user".

skizzo’s picture

What if each domain has a mobile site? Could the mobile_tools settings (in point 4 above) be handled by domain_settings module so that it can be set on a per-domain basis? [edit] somewhat related issue http://drupal.org/node/1206812

chawl’s picture

subs

drvdt’s picture

I have a system like this: one code + one database.
Use Domain Access make some sites: http://tanghuyetap.vn ; http://yhvn.vn ; http://chidaotuyen.vn. They are shared contents but views-themes are different.
I want to use Mobile Tools to make mobile site for each of them: no redirect to m.sitename.vn ; only change theme when someone uses mobile. It was fine if you access all domain: form mobline --> see mobile themes, and from desktop --> see desktop themes.
My broblem: front page of desktop and mobile of main domain can be deffirent. But other domains can not: same front page. I want they must be different.
Can anybody help me?

Thanks so much,

slowflyer’s picture

Hi drvdt,

maybe the context module could help you out. You can specify domain spefic "rules" which content or block to display.

cheers

Jevedor’s picture

Has there been anything resolved for this. I am having problems similar to what the OP has posted and I am wondering if a solution has been found.

Here is the scenario. I have 3 sites all on the same code base. Lets call them domain.com, ca.domain.com and mx.domain.com. The subdomains are regional versions of the default site. All three need to redirect to m.domain.com when hit via a mobile device. This currently is not working. Mobile detection seems to only occur when on the default domain.

What is more though is that when using a browser with mobile detection turned on if I go to ca.domain.com or mx.domain.com I am redirected back to the default domain which is not wanted or expected behavior.

Anyone have any thoughts or clues?

mjt772’s picture

Subscribe

loophole080’s picture

Title: Mobile tools & Domain access module (mobile site per domain - possible solution?) » Mobile tools & Domain access module
Status: Needs review » Active

Hi everyone,

I have a solution that allows a mobile site per domain (eg example.com/m.example.com, example.fr/m.example.fr).

Turns out to be quite simple in the end, here's what to do...

[NB We are NOT going to use Mobile Tools for the theme switching, we'll do that via Domain Theme from the Domain Access suite.]

1) Setup the Domain Access suite as you need, and configure your multiple domains (eg example.com, example.fr, etc.).

2) Create subdomain for each of your domains using the "m." pattern (eg m.example.com, m.example.fr, etc.).

3) Add a "domain record" in the Domain Access UI for each "m." subdomain.

4) Set the theme to your mobile one for each subdomain in the Domain Access UI (and any other per domain custom settings you need, eg languages). Make sure everything is working by visiting the "m." subdomains from your desktop browser.

5) Install and enable the Mobile Tools module. LEAVE THE SETTINGS AT DEFAULTS. So, on the Mobile Tools settings page the Mobile URL should match the "m." subdomain of your DA default domain and the Desktop URL should be your DA default domain. Under "Redirection options" leave the "Enable automatic redirection of the mobile user" disabled.

6) Create a custom module (in the snippet below it's called "MYMODULE") and paste in this hook_init() code:

/**
 * Implementation of hook_init().
 *
 * Using Mobile Tools, we're extending the redirect to support multiple mobile domains.
 *
 * NB: ASSUMES MOBILE SITES ARE SETUP AS "m." SUBDOMAINS (using Domain Access)
 *
 * Checks if mobile device, or if the Mobile Tools override cookie is set then redirects accordingly.
 *
 */
function MYMODULE_init() {
	$mobile_mode = mobile_tools_get_device();
	if ($mobile_mode['type'] === 'mobile') {
		// check it's a valid host for security 
		if (drupal_valid_http_host($_SERVER['HTTP_HOST']) === 1) {
			// if NOT already on a mobile version of the site, then redirect
			if (!preg_match('/m\./', $_SERVER['HTTP_HOST'])) {
				// set mobile domain redirect and trim www and device override cookie param if present  
				$redirect = 'http://m.' . preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']) . preg_replace('/.device=.*/', '', request_uri());
				drupal_goto($redirect);				
			}
		}	
	}
}

7) Enable your custom module and test from your mobile for each main domain, eg example.com should redirect to m.example.com, etc and show mobile theme, language, etc as configured through Domain Access.

=================

This is particularly handy if you need different languages on each domain and a mobile equivalent. You can also now use the Domain Access publishing options to control what content is available on each individual mobile subdomain. You can also still use the Mobile Tools device override cookies too :-)

I'm just polishing off a little module to do this and also provide a "switch to desktop site" link when on a mobile. In the meantime, the above should get you going.

loophole080’s picture

Title: Mobile tools & Domain access module » Mobile tools & Domain access module (mobile site per domain - possible solution?)
Status: Active » Needs review

updating title and status

minoroffense’s picture

Title: Mobile tools & Domain access module » Mobile tools & Domain access module (mobile site per domain - possible solution?)
Category: bug » support
Priority: Major » Normal
minoroffense’s picture

Version: 6.x-2.1 » 6.x-2.x-dev
koritala.mahesh’s picture

Title: Mobile tools & Domain access module » Mobile tools & Domain access module (mobile site per domain - possible solution?)
Version: 6.x-2.1 » 6.x-2.x-dev
Category: bug » support
Priority: Major » Normal

hi,

this is mahesh, i need one small help regarding..i have my website named as xxx. if i access my website in mobile devices, i need to get the url as m.xxx(mobile.websitename). how can i get like this ? could any one please send the code to my mail. my mail id is koritala.mahesh@gmail.com. i hope will expect atleast one for this... thank u