--- includes/common.inc	2008-02-02 16:32:15.000000000 -0500
+++ includes/common_new.inc	2008-02-02 16:06:15.000000000 -0500
@@ -1186,6 +1186,14 @@ function url($path = NULL, $query = NULL
     $clean_url = (bool)variable_get('clean_url', '0');
   }
 
+  // Preserve the original path before aliasing.
+  $original_path = $path;
+
+  if (function_exists('custom_url_rewrite_outbound')) {
+    // Modules may alter outbound links by reference.
+    custom_url_rewrite_outbound($path, $query, $fragment, $absolute, $base_url, $original_path);
+  }
+
   $base = ($absolute ? $base_url . '/' : base_path());
 
   // The special path '<front>' links to the default front page.
