diff --git a/domain.admin.inc b/domain.admin.inc
index 454ea4c..bbd50ea 100644
--- a/domain.admin.inc
+++ b/domain.admin.inc
@@ -190,6 +190,14 @@ function domain_configure_form($form, &$form_state, $user_submitted = FALSE) {
     '#description' => t('If set, users with the <em>set domain access</em> permission will be able to view the node access rules for each node. See the README for more details.')
   );
 
+  $tools = module_invoke_all('domain_development_tools');
+  $form['domain_development_tools'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Development tools'),
+    '#default_value' => variable_get('domain_development_tools', array()),
+    '#options' => $tools,
+    '#description' => t('Enable features to help with site development'),
+  );
   $form['domain_force_admin'] = array(
     '#type' => 'radios',
     '#title' => t('Enforce rules on administrators'),
@@ -442,13 +450,16 @@ function domain_form($form, &$form_state, $domain = array(), $arguments = array(
   else {
     $description = t('Must contain only dots, lowercase alphanumeric and ASCII characters, dashes and a colon (if using alternative ports).');
   }
+  if (isset($domain['canonical'])) {
+    drupal_set_message(t('Currently editing %canonical from the alias %alias', array('%canonical' => $domain['canonical'], '%alias' => $domain['subdomain'])), 'warning');
+  }
   $form['subdomain'] = array(
     '#type' => 'textfield',
     '#title' => t('Domain'),
     '#size' => 40,
     '#maxlength' => 80,
     '#required' => TRUE,
-    '#default_value' => $domain['subdomain'],
+    '#default_value' => isset($domain['canonical']) ? $domain['canonical'] : $domain['subdomain'],
     '#description' => t('The allowed domain, using the full <em>path.example.com</em> format.') . '<br />' . t('Leave off the http:// and the trailing slash and do not include any paths.') . '<br />' . $description
   );
   $form['machine_name'] = array(
diff --git a/domain.api.php b/domain.api.php
index 798cd2c..f73ca04 100644
--- a/domain.api.php
+++ b/domain.api.php
@@ -836,3 +836,17 @@ function hook_domain_reassign($old_domain, $new_domain, $table) {
       ->execute();
   }
 }
+
+/**
+ * Registers active/inactive settings for common development tools.
+ *
+ * Your module should return an array keyed by a unique identifier and a value
+ * of a human-readable description of the feature.
+ *
+ * To check the status of your tool setting, use domain_development_tools().
+ */
+function domain_alias_domain_development_tools() {
+  return array(
+    'alias_hostname' => t('Replace canonical host name with matching alias.'),
+  );
+}
diff --git a/domain.module b/domain.module
index 2d49d23..c9ae548 100644
--- a/domain.module
+++ b/domain.module
@@ -1535,9 +1535,12 @@ function domain_check_primary($msg = 'default') {
   $default = domain_default(TRUE, TRUE);
   if ($_domain['domain_id'] != $default['domain_id']) {
     if ($msg == 'default') {
-      drupal_set_message(t('You have been redirected: This page must be accessed from the primary domain.'));
+      $text = t('You have been redirected: This page must be accessed from the primary domain.');
     }
     elseif (!empty($msg)) {
+      $test = $msg;
+    }
+    if (!$redirect = domain_development_tools('disable_redirect')) {
       drupal_set_message($msg);
     }
     domain_goto($default);
@@ -1652,9 +1655,14 @@ function domain_check_scheme($scheme) {
  */
 function domain_goto($domain) {
   $_domain = domain_get_domain();
+
   // We must be on the proper domain, see http://drupal.org/node/186153.
   if ($domain != -1 && $_domain['domain_id'] != $domain['domain_id']) {
     $path = domain_get_uri($domain);
+    if ($redirect = domain_development_tools('disable_redirect')) {
+      drupal_set_message(t('Redirect request to !url detected.', array('!url' => l($path, $path))), 'warning');
+      return;
+    }
     drupal_goto($path);
   }
 }
@@ -4141,3 +4149,26 @@ function domain_default_node_access_settings($type) {
   }
   return $settings;
 }
+
+/**
+ * Implements hook_domain_development_tools().
+ */
+function domain_domain_development_tools() {
+  return array(
+    'disable_redirect' => t('Disable redirections to primary domain'),
+  );
+}
+
+/**
+ * Returns the status of development tools.
+ *
+ * @param $tool
+ *   The name of a development tool.
+ *
+ * @return
+ *   TRUE or FALSE.
+ */
+function domain_development_tools($tool) {
+  $tools = variable_get('domain_development_tools', array());
+  return !empty($tools[$tool]);
+}
diff --git a/domain_alias/domain_alias.domain.inc b/domain_alias/domain_alias.domain.inc
index d599636..2d117e2 100644
--- a/domain_alias/domain_alias.domain.inc
+++ b/domain_alias/domain_alias.domain.inc
@@ -30,10 +30,16 @@ function domain_alias_domain_nav($domain) {
  * Adds a list of all aliases for the current domain.
  */
 function domain_alias_domain_load(&$domain) {
+  $_domain = domain_get_domain();
   // Get the domain aliases
   $domain['aliases'] = domain_alias_list($domain['domain_id']);
-  if (isset($domain['active_alias_id'])) {
-    $domain['aliases'][$domain['active_alias_id']]['active'] = TRUE;
+  if (isset($_domain['active_alias_id']) && isset($domain['aliases'][$_domain['active_alias_id']])) {
+    $domain['aliases'][$_domain['active_alias_id']]['active'] = TRUE;
+    if (domain_development_tools('alias_hostname')) {
+      $domain['canonical'] = $domain['subdomain'];
+      $domain['subdomain'] = $_SERVER['HTTP_HOST'];
+      $domain['path'] = domain_get_path($domain);
+    }
   }
 }
 
@@ -47,3 +53,12 @@ function domain_alias_domain_delete($domain, $form_values = array()) {
     ->condition('domain_id', $domain['domain_id'])
     ->execute();
 }
+
+/**
+ * Implements hook_domain_development_tools().
+ */
+function domain_alias_domain_development_tools() {
+  return array(
+    'alias_hostname' => t('Replace canonical host name with matching alias.'),
+  );
+}
