diff --git a/includes/install.inc b/includes/install.inc
index e52c0ad..199fd4b 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -216,7 +216,7 @@ function drupal_detect_baseurl($file = 'install.php') {
   $proto = $_SERVER['HTTPS'] ? 'https://' : 'http://';
   $host = $_SERVER['SERVER_NAME'];
   $port = ($_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT']);
-  $uri = preg_replace("/\?.*/", '', $_SERVER['REQUEST_URI']);
+  $uri = preg_replace("/\?.*/", '', request_uri());
   $dir = str_replace("/$file", '', $uri);
 
   return "$proto$host$port$dir";
