Hi Guys,

I have an installation of Drupal 6 with domain access (using a number of domains) with

maindomain.co.uk
domain.co.uk
domain.com
otherdomain.co.uk
anotherdomain.co.uk

I would like all subdomains of each .co.uk to be a site, and for all of the subdomains of the relavent .com's to redirect to the www.*.co.uk
I added domain access, and once I added content, I had the 4 www.*.co.uk sites up. I wanted to have the (non www) to point to the www as well (legacy), and for the .com's to redirect to the .co.uk

I have ticked domain alias, in the modules, and have added *.domain.co.uk & *.domain.com in www.domain.co.uk and have tried with and without the redirect ticked...

I have the www.domain.co.uk working, but the domain.co.uk and the domain.com and www.domain.com just point to the 'maindomain' site content.

I know I must have missed something obvious, what it is I have no idea...

Anyone any ideas??

Thanks in advance

Handy

Comments

ayesh’s picture

Didn't get your situation right I guess. Sorry for that.

Add following domains to system in DA admin pages.
maindomain.co.uk
domain.co.uk
domain.com
otherdomain.co.uk
anotherdomain.co.uk

And check the relevant check box to assume www.*.co.uk as an alias of *.co.uk site (same for .coms).

Then, follow http://drupal.org/node/1358644 and add correct .htaccess redirect rules to redirect to www version (written by an awesome guy - you'll see).
DA is built mostly with sub-domain based site network in mind - that's why you can't redirect to www version (www.en.domain.com -> en.domain.com)

Handy-Andy’s picture

I reinstalled from the last issue and it didn't re-occur, so I don't know what that was...

OK - I've added that block to .htaccess, and restarted apache, still nothing.
I have added all the domains into DA as
www.maindomain.co.uk
www.domain.co.uk
www.domain.com
www.otherdomain.co.uk
www.anotherdomain.co.uk

Do I need to change them to just:
maindomain.co.uk
domain.co.uk
domain.com
otherdomain.co.uk
anotherdomain.co.uk

Or add both the www, and non-www domains to DA?

ayesh’s picture

Don't add both domains. Just add non-www versions, and force DA to assume www as an alias of main domain. and then use .htaccess to redirect.

Handy-Andy’s picture

OK - I can see that it works for www.domain -> domain
But the
Administer >> Site Building >> Domains
Advanced Settings

WWW prefix handling:
Process all host requests normally
Treat www.*.example.com as an alias of *.example.com

If set, calls to www.* will be treated as if the www. did not exist. Users will be taken from www.example.com to example.com, so your domains must be registered without the www. prefix.

When I tick the box for "Treat www.*......" it redirects to the nonwww.domain as opposed to the www.domain even with the

•To redirect users to www version.

  # Redirect all users to access the site WITH the 'www.' prefix 
 RewriteCond %{HTTP_HOST} !^www\. [NC] 
 RewriteCond %{HTTP_HOST} !\.([a-z-]+\.[a-z]{2,6})$ [NC] 
 RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Any ideas??

A.

PS. I wish I liked the non-www version as opposed to the www. version - Life would be so much more simple!