diff --git a/auth_ssl_redirect.module b/auth_ssl_redirect.module
index 0520955..e3b36ad 100644
--- a/auth_ssl_redirect.module
+++ b/auth_ssl_redirect.module
@@ -17,7 +17,14 @@ function auth_ssl_redirect_boot() {
       unset($_GET['q']);
       $query = $_GET;
     }
-    $base = 'https://' . parse_url($base_url, PHP_URL_HOST) . base_path();
+    // We need to get ports too, just in case.
+    $port = parse_url($base_url, PHP_URL_PORT);
+    if (!empty($port)) {
+      $base = 'http://' . parse_url($base_url, PHP_URL_HOST) . ':' . $port . base_path();
+    }
+    else {
+      $base = 'http://' . parse_url($base_url, PHP_URL_HOST) . base_path();
+    }
     // Issue redirect.
     drupal_goto($base . $path, array('query' => $query));
   }
