diff --git a/settings_custom_url.inc b/settings_custom_url.inc
index 39ed0fe..90ff8d5 100644
--- a/settings_custom_url.inc
+++ b/settings_custom_url.inc
@@ -126,6 +126,15 @@ function domain_url_outbound_alter(&$path, &$options, $original_path) {
         // TODO: merge this code with the above for cleanup.
       }
     }
+    // Custom support for comment links.
+    if (module_exists('comment')) {
+      // Must use md5 here, to prevent array keys from breaking.
+      $name = md5($path);
+      if (!isset($path_lookup[$name])) {
+        $path_lookup[$name] = TRUE;
+        domain_comment_path($path, $options, $original_path);
+      }
+    }
   }
   // We may have to refactor this for D7.
   if (!isset($path_rewrite)) {
@@ -136,3 +145,27 @@ function domain_url_outbound_alter(&$path, &$options, $original_path) {
     domain_path($target_domain_id, $path, $options, $original_path);
   }
 }
+
+/**
+ * Support comment link rewriting.
+ */
+function domain_comment_path(&$path, &$options, $original_path) {
+  if (arg(0, $path) == 'comment') {
+    $_domain = domain_get_domain();
+    $cid = arg(1, $path);
+    // Comment replies use cid as the fourth item.
+    if ($cid == 'reply') {
+      $cid = arg(3, $path);
+    }
+    if (!empty($cid) && $comment = comment_load($cid)) {
+      $source = domain_get_node_match($comment->nid);
+      if ($source['domain_id'] == $_domain['domain_id']) {
+        return;
+      }
+      $options['absolute'] = TRUE;
+      // In this case, the $base_url cannot have a trailing slash
+      $options['base_url'] = rtrim($source['path'], '/');
+      return $source;
+    }
+  }
+}
diff --git a/tests/domain.test b/tests/domain.test
index 5c60853..54ecdc2 100644
--- a/tests/domain.test
+++ b/tests/domain.test
@@ -983,6 +983,72 @@ class DomainInvalidTest extends DomainTestCase {
   }
 }
 
+class DomainCommentTest extends DomainTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Domain comment links tests',
+      'description' => 'Rewrite links for comments.',
+      'group' => 'Domain Access',
+    );
+  }
+
+  // On setup, install our test module.
+  function setUp($list = array()) {
+    parent::setUp($list);
+  }
+
+  function testDomainComments() {
+    // Create domains.
+    $this->domainCreateDomains();
+    $default = domain_default();
+    variable_set('domain_seo', 1);
+
+    // Save a node comment.
+    $node = node_load(1);
+    $comment_array = array(
+      'node_type' => $node->type,
+      'nid' => $node->nid,
+      'subject' => 'Test comment',
+      'comment_body' => $this->randomName(255),
+      'mail' => 'foo@example.com',
+      'is_anonymous' => TRUE,
+      'cid' => NULL,
+      'pid' => NULL,
+      'uid' => 0,
+    );
+    $comment = (object) $comment_array;
+    comment_submit($comment);
+    comment_save($comment);
+
+    // Test rewrites.
+    global $base_path;
+    $this->drupalGet('node/1');
+    $this->assertRaw('href="' . $base_path . 'comment/1#comment-1"', t('Comment link goes to default domain.'));
+    $link = url('comment/1');
+    $this->assertTrue($link == $base_path . 'comment/1', t('URL rewrite for comment link returns correctly.'));
+    $reply = url('comment/reply/1/1');
+    $this->assertTrue($reply == $base_path . 'comment/reply/1/1', t('URL rewrite for comment reply link returns correctly.'));
+
+    // Re-save the node assigned to domain 3.
+    $node->domains = array(3 => 3);
+    $node->domain_site = FALSE;
+    node_save($node);
+    $node = node_load(1);
+
+    $domain = domain_load(3);
+    $this->drupalGet('node/1');
+    $this->assertRaw('href="' . $domain['path'] . 'comment/1#comment-1"', t('Comment link goes to proper domain.'));
+
+    // These tests are failing.
+    $link = url('comment/1');
+    $this->assertTrue($link == $domain['path'] . 'comment/1', t('URL rewrite for comment link returns correctly.'));
+    $reply = url('comment/reply/1/1');
+    $this->assertTrue($reply == $domain['path'] . 'comment/reply/1/1', t('URL rewrite for comment reply link returns correctly.'));
+
+
+  }
+}
+
 class DomainTokenTest extends DomainTestCase {
   public static function getInfo() {
     return array(
