You are here

function domain_alias_init in Domain Access 6.2

Same name and namespace in other branches
  1. 7.3 domain_alias/domain_alias.module \domain_alias_init()
  2. 7.2 domain_alias/domain_alias.module \domain_alias_init()

Implement hook_init().

If redirection is enabled for the active domain alias then we redirect to the main domain.

File

domain_alias/domain_alias.module, line 60
Interface for advanced domain matching for Domain Access.

Code

function domain_alias_init() {
  global $_domain;

  // Redirect to main domain if active domain alias is set to redirect.
  // $_domain['redirect'] gets set in domain_alias_domain_bootstrap_lookup().
  if (isset($_domain['redirect']) && $_domain['redirect'] == TRUE) {
    $domain = domain_lookup($_domain['domain_id']);
    drupal_goto(domain_get_uri($domain));
  }
}