diff --git a/includes/common.inc b/includes/common.inc
index 3069aff273e8f87d6bfc3634aa3ef8b0b6e6a16c..5316afad8d40e0ed2e097dfaa3581a3ee772b05f 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -2092,8 +2092,8 @@ function url($path = NULL, array $options = array()) {
     if ($options['query']) {
       $path .= (strpos($path, '?') !== FALSE ? '&' : '?') . drupal_http_build_query($options['query']);
     }
-    if (isset($options['https']) && variable_get('https', FALSE)) {
-      if ($options['https'] === TRUE) {
+    if (isset($options['https'])) {
+      if (variable_get('https', FALSE) && $options['https'] === TRUE) {
         $path = str_replace('http://', 'https://', $path);
       }
       elseif ($options['https'] === FALSE) {
@@ -2108,8 +2108,8 @@ function url($path = NULL, array $options = array()) {
 
   // The base_url might be rewritten from the language rewrite in domain mode.
   if (!isset($options['base_url'])) {
-    if (isset($options['https']) && variable_get('https', FALSE)) {
-      if ($options['https'] === TRUE) {
+    if (isset($options['https'])) {
+      if (variable_get('https', FALSE) && $options['https'] === TRUE) {
         $options['base_url'] = $base_secure_url;
         $options['absolute'] = TRUE;
       }
@@ -2117,6 +2117,9 @@ function url($path = NULL, array $options = array()) {
         $options['base_url'] = $base_insecure_url;
         $options['absolute'] = TRUE;
       }
+      else {
+        $options['base_url'] = $base_url;
+      }
     }
     else {
       $options['base_url'] = $base_url;