? domain_default_source.patch
Index: domain.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.admin.inc,v
retrieving revision 1.4
diff -u -p -r1.4 domain.admin.inc
--- domain.admin.inc	8 Jun 2008 16:24:14 -0000	1.4
+++ domain.admin.inc	10 Jun 2008 15:50:55 -0000
@@ -274,6 +274,21 @@ function domain_configure_form($form_sta
       This feature requires custom_url_rewrite_outbound() to be installed.')
   );
 
+  $options = array();
+  foreach (domain_domains() as $data) {
+    // The domain must be valid.
+    if ($data['valid']) {
+      $options[$data['domain_id']] = $data['sitename'];
+    }
+  }
+  $form['domain_advanced']['domain_default_source'] = array(
+    '#type' => 'select',
+    '#title' => t('Default source domain'),
+    '#options' => $options,
+    '#default_value' => variable_get('domain_default_source', 0),
+    '#description' => t('When rewriting urls, nodes assigned to all affiliates will be sent to this domain.'),
+  );
+
   $form['domain_advanced']['domain_www'] = array(
     '#type' => 'radios',
     '#title' => t('WWW prefix handling'),
Index: settings_custom_url.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/settings_custom_url.inc,v
retrieving revision 1.6
diff -u -p -r1.6 settings_custom_url.inc
--- settings_custom_url.inc	8 Jun 2008 16:24:14 -0000	1.6
+++ settings_custom_url.inc	10 Jun 2008 15:50:55 -0000
@@ -59,7 +59,7 @@ function custom_url_rewrite_outbound(&$p
       }
       // This path has matched a node id, so it may need to be rewritten.
       if ($nid) {
-        $root = domain_default();
+        $root = domain_lookup(variable_get('domain_default_source', 0));
         // Remove redundancy from the domain_site check.
         if (!isset($domain_site[$nid])) {
           // If this check works, we don't need to rewrite the path unless SEO rules demand it.
