diff --git a/core/includes/common.inc b/core/includes/common.inc
index 5a146a8..2f55065 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -3344,7 +3344,7 @@ function drupal_pre_render_styles($elements) {
         // for the aggregate file.
         if (isset($group['data'])) {
           $element = $link_element_defaults;
-          $element['#attributes']['href'] = file_create_url($group['data']);
+          $element['#attributes']['href'] = file_create_url($group['data'], TRUE);
           $element['#attributes']['media'] = $group['media'];
           $element['#browsers'] = $group['browsers'];
           $elements[] = $element;
@@ -3370,7 +3370,7 @@ function drupal_pre_render_styles($elements) {
               // browser-caching. IE7 does not support a media type on the
               // @import statement, so we instead specify the media for the
               // group on the STYLE tag.
-              $import[] = '@import url("' . check_plain(file_create_url($item['data']) . '?' . $query_string) . '");';
+              $import[] = '@import url("' . check_plain(file_create_url($item['data'], TRUE) . '?' . $query_string) . '");';
             }
           }
           // In addition to IE's limit of 31 total CSS inclusion tags, it also
@@ -3401,7 +3401,7 @@ function drupal_pre_render_styles($elements) {
             // The dummy query string needs to be added to the URL to control
             // browser-caching.
             $query_string_separator = (strpos($item['data'], '?') !== FALSE) ? '&' : '?';
-            $element['#attributes']['href'] = file_create_url($item['data']) . $query_string_separator . $query_string;
+            $element['#attributes']['href'] = file_create_url($item['data'], TRUE) . $query_string_separator . $query_string;
             $element['#attributes']['media'] = $item['media'];
             $element['#browsers'] = $group['browsers'];
             $elements[] = $element;
@@ -3491,7 +3491,7 @@ function drupal_build_css_cache($css) {
         $contents = drupal_load_stylesheet($stylesheet['data'], TRUE);
 
         // Build the base URL of this CSS file: start with the full URL.
-        $css_base_url = file_create_url($stylesheet['data']);
+        $css_base_url = file_create_url($stylesheet['data'], TRUE);
         // Move to the parent.
         $css_base_url = substr($css_base_url, 0, strrpos($css_base_url, '/'));
         // Simplify to a relative URL if the stylesheet URL starts with the
@@ -4290,7 +4290,7 @@ function drupal_pre_render_scripts($elements) {
     // script element for this file.
     if ($group['type'] == 'file' && isset($group['data'])) {
       $element = $element_defaults;
-      $element['#attributes']['src'] = file_create_url($group['data']);
+      $element['#attributes']['src'] = file_create_url($group['data'], TRUE);
       $element['#browsers'] = $group['browsers'];
       $elements[] = $element;
     }
@@ -4322,7 +4322,7 @@ function drupal_pre_render_scripts($elements) {
           case 'file':
             $query_string = empty($item['version']) ? $default_query_string : $js_version_string . $item['version'];
             $query_string_separator = (strpos($item['data'], '?') !== FALSE) ? '&' : '?';
-            $element['#attributes']['src'] = file_create_url($item['data']) . $query_string_separator . ($item['cache'] ? $query_string : REQUEST_TIME);
+            $element['#attributes']['src'] = file_create_url($item['data'], TRUE) . $query_string_separator . ($item['cache'] ? $query_string : REQUEST_TIME);
             break;
 
           case 'external':
diff --git a/core/includes/file.inc b/core/includes/file.inc
index 2771f62..c40f324 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -437,7 +437,7 @@ function file_stream_wrapper_get_instance_by_scheme($scheme) {
  *
  * @see http://drupal.org/node/515192
  */
-function file_create_url($uri) {
+function file_create_url($uri, $this_server = FALSE) {
   // Allow the URI to be altered, e.g. to serve a file from a CDN or static
   // file server.
   drupal_alter('file_url', $uri);
@@ -458,7 +458,13 @@ function file_create_url($uri) {
     else {
       // If this is not a properly formatted stream, then it is a shipped file.
       // Therefore, return the urlencoded URI with the base URL prepended.
-      return $GLOBALS['base_url'] . '/' . drupal_encode_path($uri);
+      // If specified, return a URL that is relative to the current scheme, server, and port.
+      if ($this_server) {
+        return $GLOBALS['base_path'] . drupal_encode_path($uri);
+      }
+      else {
+        return $GLOBALS['base_url'] . '/' . drupal_encode_path($uri);
+      }
     }
   }
   elseif ($scheme == 'http' || $scheme == 'https') {
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index d044f06..c9abcce 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -1414,10 +1414,10 @@ function theme_get_setting($setting_name, $theme = NULL) {
       // Generate the path to the logo image.
       if ($cache[$theme]['toggle_logo']) {
         if ($cache[$theme]['default_logo']) {
-          $cache[$theme]['logo'] = file_create_url(dirname($theme_object->filename) . '/logo.png');
+          $cache[$theme]['logo'] = file_create_url(dirname($theme_object->filename) . '/logo.png', TRUE);
         }
         elseif ($cache[$theme]['logo_path']) {
-          $cache[$theme]['logo'] = file_create_url($cache[$theme]['logo_path']);
+          $cache[$theme]['logo'] = file_create_url($cache[$theme]['logo_path'], TRUE);
         }
       }
 
@@ -1425,14 +1425,14 @@ function theme_get_setting($setting_name, $theme = NULL) {
       if ($cache[$theme]['toggle_favicon']) {
         if ($cache[$theme]['default_favicon']) {
           if (file_exists($favicon = dirname($theme_object->filename) . '/favicon.ico')) {
-            $cache[$theme]['favicon'] = file_create_url($favicon);
+            $cache[$theme]['favicon'] = file_create_url($favicon, TRUE);
           }
           else {
-            $cache[$theme]['favicon'] = file_create_url('core/misc/favicon.ico');
+            $cache[$theme]['favicon'] = file_create_url('core/misc/favicon.ico', TRUE);
           }
         }
         elseif ($cache[$theme]['favicon_path']) {
-          $cache[$theme]['favicon'] = file_create_url($cache[$theme]['favicon_path']);
+          $cache[$theme]['favicon'] = file_create_url($cache[$theme]['favicon_path'], TRUE);
         }
         else {
           $cache[$theme]['toggle_favicon'] = FALSE;
