3

Using Domain Access with Drupal 6, I am encountering an issue in the following scenario:

I set up a node published to a sub site, say:

subsite.com/node-x

If I browse to:

mainsite.com/node-x 

I would like it to redirect to:

subsite.com/node-x

However, it just renders the content on the main site domain (which the search engines would pick up as duplicate content).

Any idea how I can configure the sites to redirect to the site on which the node is published? I attempted to use Global Redirect to redirect from the main site to the full url on the sub site but Drupal told me that I was redirecting something to itself. Are web server redirects my only option?

  • For anyone looking for an update on this, I never ended up finding something that worked. I cobbled together my own module to handle it. – smp7d Sep 11 '12 at 14:53
2

There is a special module for that: https://www.drupal.org/project/domain_path_rewrite.

The idea is to check the request path before the page load and to make a redirect to the proper domain if needed. Something like:

/**
 * Implements hook_init().
 */
function domain_path_rewrite_init() {
  if ($domain_path = _domain_path_rewrite_domain_path(current_path())) {
    global $_domain;

    if (!($_domain['domain_id'] == $domain_path['domain_id'] && request_path() == $domain_path['path'])) {
      drupal_goto($domain_path['url'], array(), 301);
    }
  }
}
|improve this answer|||||
0

Yep, I'm looking for D6, too.

Looks like D7 can be found here: https://drupal.org/node/1566058

This seems to work for D6: https://drupal.org/node/704568

|improve this answer|||||
-3

I believe Domain 301 Redirect mixed with domain source will do what you are after.

The Domain 301 Redirect module allows sites to 301 redirect to a domain that is marked as the main domain. This means you can have all subdomains and other domains pointing to the site 301 redirect to a domain that you choose as the main domain. This provides great SEO benefit.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.