Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.752
diff -u -4 -p -r1.752 common.inc
--- includes/common.inc	16 Jan 2008 10:37:30 -0000	1.752
+++ includes/common.inc	22 Jan 2008 18:04:31 -0000
@@ -1313,29 +1313,29 @@ function url($path = NULL, $options = ar
   if (!isset($options['base_url'])) {
     // The base_url might be rewritten from the language rewrite in domain mode.
     $options['base_url'] = $base_url;
   }
-  $base = $options['absolute'] ? $options['base_url'] .'/' : base_path();
 
   // Preserve the original path before aliasing.
   $original_path = $path;
 
   // The special path '<front>' links to the default front page.
-  if (!empty($path) && $path != '<front>') {
-    if (!$options['alias']) {
-      $path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : '');
-    }
-    if (function_exists('custom_url_rewrite_outbound')) {
-      // Modules may alter outbound links by reference.
-      custom_url_rewrite_outbound($path, $options, $original_path);
-    }
-    $path = drupal_urlencode($options['prefix'] . $path);
+  if ($path == '<front>') {
+    $path = '';
   }
-  else {
-    // Will be empty if there is no language prefix.
-    $path = trim($options['prefix'], '/');
+  elseif (!empty($path) && !$options['alias']) {
+    $path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : '');
   }
 
+  if (function_exists('custom_url_rewrite_outbound')) {
+    // Modules may alter outbound links by reference.
+    custom_url_rewrite_outbound($path, $options, $original_path);
+  }
+
+  $base = $options['absolute'] ? $options['base_url'] .'/' : base_path();
+  $prefix = empty($path) ? rtrim($options['prefix'], '/') : $options['prefix'];
+  $path = drupal_urlencode($prefix . $path);
+
   if ($clean_url) {
     // With Clean URLs.
     if ($options['query']) {
       return $base . $path .'?'. $options['query'] . $options['fragment'];
