Index: domain.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/domain/domain.module,v
retrieving revision 1.82
diff -u -r1.82 domain.module
--- domain.module	21 Oct 2008 13:28:58 -0000	1.82
+++ domain.module	22 Oct 2008 01:43:18 -0000
@@ -714,7 +714,7 @@
   $request_uri = request_uri();
 
   $modules = _domain_path_modules();
-  if (!empty($modules)) {
+  if (!empty($modules) && !drupal_is_front_page()) {
     // If needed, let modules modify the path alias.
     $path = $_GET['q'];
     $alias = domain_path($domain['domain_id'], $path);
Index: settings_custom_url.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/domain/settings_custom_url.inc,v
retrieving revision 1.14
diff -u -r1.14 settings_custom_url.inc
--- settings_custom_url.inc	21 Oct 2008 13:39:37 -0000	1.14
+++ settings_custom_url.inc	22 Oct 2008 01:45:11 -0000
@@ -56,6 +56,7 @@
         }
       }
     }
+    $target_domain_id = $_domain['domain_id'];
     // This path has matched a node id, so it may need to be rewritten.
     if ($nid) {
       $root = domain_lookup(variable_get('domain_default_source', 0));
@@ -88,6 +89,7 @@
           if (isset($source)) {
             $seo = FALSE;
           }
+          $target_domain_id = $domain[$nid]['domain_id'];
         }
       }
       // If strict SEO rules are enabled, we set "all affiliate" links to the root domain.
@@ -96,6 +98,7 @@
         $options['absolute'] = TRUE;
         // In this case, the $base_url cannot have a trailing slash
         $options['base_url'] = rtrim($root['path'], '/');
+        $target_domain_id = $root['domain_id'];
       }
     }
     // We may have to implement hook_domainpath().
@@ -103,8 +106,8 @@
       $path_rewrite = count(_domain_path_modules());
     }
     // Allow path changes, if needed.
-    if ($path_rewrite > 0) {
-      $path = domain_path($domain[$nid]['domain_id'], $original_path, isset($options['language']) ? $options['language']->language : '');
+    if ($path_rewrite > 0 && $path != '') {
+      $path = domain_path($target_domain_id, $original_path, isset($options['language']) ? $options['language']->language : '');
     }
   }
 }

