=== modified file 'a/includes/bootstrap.inc'
--- a/includes/bootstrap.inc	
+++ b/includes/bootstrap.inc	
@@ -557,19 +557,21 @@ function check_plain($text) {
  * equivalent using other environment variables.
  */
 function request_uri() {
-
-  if (isset($_SERVER['REQUEST_URI'])) {
-    $uri = $_SERVER['REQUEST_URI'];
-  }
-  else {
-    if (isset($_SERVER['argv'])) {
-      $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0];
+  static $uri;
+  if (!isset($uri)) {
+    if (isset($_SERVER['REQUEST_URI'])) {
+      $uri = $_SERVER['REQUEST_URI'];
     }
     else {
-      $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
+      if (isset($_SERVER['argv'])) {
+        $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0];
+      }
+      else {
+        $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];
+      }
     }
+    $uri = substr($uri, strlen(base_path()));
   }
-
   return $uri;
 }
 
=== modified file 'a/modules/system.module'
--- a/modules/system.module	
+++ b/modules/system.module	
@@ -55,7 +55,7 @@ function system_perm() {
  */
 function system_elements() {
   // Top level form
-  $type['form'] = array('#method' => 'post', '#action' => request_uri(), '#redirect' => $_GET['q']);
+  $type['form'] = array('#method' => 'post', '#action' => base_path() . request_uri(), '#redirect' => $_GET['q']);
 
   // Inputs
   $type['checkbox'] = array('#input' => TRUE, '#return_value' => 1);
