I have a live site at www.example.com and a development instance at devel.example.com, a direct copy on the same server running under that subdomain.

I need to use a subdomain to create a wholesale site that will use the same content and products, hence the Domain Access module.

So the final setup should be:

- www.example.com
- wholesale.example.com

But first it needs to be configured on the development instance so I can actually test things and reconfigure and develop to ensure things stay working, then make it easy to export via Features. So:

- devel.example.com
- wholesale.devel.example.com

It seems Domain Alias's would be the answer, somehow. But I'm not certain how to set them up for this use case. The README is helpful, but doesn't specifically address it. And I'm confused about what NOT REDIRECTING an alias actually does.

Should my main domains, even on development be example.com and wholesale.example.com, and then those are aliased? But if they are aliased with devel.example.com and wholesale.devel.example.com respectively, wouldn't people just get redirected to the live site?

I have looked at http://drupal.org/node/766970, but am still confused. How does that actually help?

Any insight would be greatly appreciated.

Thanks!

Comments

agentrickard’s picture

See if https://drupal.org/node/1096988 helps.

Not redirecting an alias is likely what you want during development. (Or for your development domains.) The best case is to register your canonical domains and then alias the others. I then use the hook_domain_load() trick on my projects, so that the development domains work as expected.

jazzdrive3’s picture

Thanks. I've got it almost working. The alias returns the correct domain id. However, the domain_load trick you do has me going in circles, and I suspect that's why I'm having my current issue.

When I login from wholesale.devel.example.com, it then redirects me to devel.example.com. Likewise when I flush all of the caches, or anytime there is a drupal_goto I suspect.

Maybe its because the $base_url is set in settings.php (which is required for my local environment)?

jazzdrive3’s picture

Ah, now I see in the docs where base_url cannot be set. So that's it. Login forms work just fine now.

Still confused about exactly what your domain_load trick is for.

agentrickard’s picture

Domain Access rewrites canonical URLs for content and for some administration pages. The domain_load() trick ensures that the base URL for those rewrites is sensitive to your environment.

That is, it changes the canonical URL if you are on the dev server.