--- globalredirect.module.orig	2008-08-09 19:59:04.000000000 +0200
+++ globalredirect.module	2008-08-09 20:19:50.000000000 +0200
@@ -25,8 +25,12 @@
    * We need to do a test to make sure we only clean up URL's for the main request. This stops modules such as
    * the Ad Module which had its own script in its folder doing a bootstrap which invoked hook_init and caused some banners to get "cleaned up"
    * See issues: http://drupal.org/node/205810 and http://drupal.org/node/278615
+   *
+   * When php is running in fast-cgi mode, it's possible $_SERVER['SCRIPT_NAME'] is empty due to various reasons. It's available in $_ENV though. 
+   * See issues: http://www.php.net/manual/en/reserved.variables.php#55475 and/or http://bugs.php.net/bug.php?id=38141 
    */
-  if ($_SERVER['SCRIPT_NAME'] != $GLOBALS['base_path'] .'index.php') return FALSE;
+  $filename = (!empty($_SERVER['SCRIPT_NAME'])) ? $_SERVER['SCRIPT_NAME'] : $_ENV['SCRIPT_NAME'];
+  if ($filename != $GLOBALS['base_path'] .'index.php') return FALSE;
   
   /**
    * If the site is in offline mode there is little point doing any of this as you might end up redirecting to a 503.
