Index: drupal/includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.407
diff -u -r1.407 common.inc
--- drupal/includes/common.inc	28 Nov 2004 12:28:35 -0000	1.407
+++ drupal/includes/common.inc	28 Nov 2004 18:45:46 -0000
@@ -1394,7 +1394,7 @@
 function url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE) {
   global $base_url;
 
-  static $script;
+  static $script, $parts;
 
   if (empty($script)) {
     // On some web servers, such as IIS, we can't omit "index.php".  So, we
@@ -1409,7 +1409,16 @@
     $fragment = '#'. $fragment;
   }
 
-  $base = ($absolute ? $base_url . '/' : '');
+  //$base = ($absolute ? $base_url . '/' : '');
+  if ($absolute) {
+	$base = $base_url . '/';
+	}
+  else {
+  if (!isset($parts) ) {
+	$parts = parse_url($base_url);
+	} 
+  $base = ( $path == '/' ? $base : $parts['path'] . '/' );
+  }
 
   if (variable_get('clean_url', '0') == '0') {
     if (isset($path)) {
