--- mobile_tools.module	2010-06-25 15:46:01.000000000 +0200
+++ mobile_tools.new.module	2010-06-25 14:34:11.000000000 +0200
@@ -943,6 +943,12 @@ function mobile_tools_get_redirect_url()
   }
   $query = (count($query) > 0) ? implode('&', $query) : '';
   //create the path and reassemble
-  $base = preg_replace('{/$}', '', variable_get('mobile_tools_mobile_url', ''));
+  $base_path = substr(base_path(),0,-1);
+  $base = variable_get('mobile_tools_mobile_url', '');
+
+  if (strrpos($base,'/')==strlen($base)-1) $base = substr($base,0,-1); // remove last '/' if exists
+  if (strrpos($base,$base_path) === (strlen($base)-strlen($base_path)) ) $base = substr($base,0,-strlen($base_path)); // remove base_path() if already included at the end (for multisites configured per directory)
+  if (substr($base,0,4)!='http') $base = 'http://'.$base; // add 'http://' at the beginning to form an absolute path
+  
   return $base . url($_GET['q'], array('query' => $query));
 }
