Index: defines.php
===================================================================
--- defines.php	(revision 18271)
+++ defines.php	(working copy)
@@ -15,7 +15,12 @@
 
 // Figure out the root path for this mythweb installation.  We need this in order
 // to cleanly reference things like the /js directory from subpaths.
+if (isset($_SERVER['ORIG_SCRIPT_NAME'])) {
+    define('root', str_replace('//', '/', dirname($_SERVER['ORIG_SCRIPT_NAME']).'/'));
+ }
+ else {
     define('root', str_replace('//', '/', dirname($_SERVER['SCRIPT_NAME']).'/'));
+ }
 
 // Several sections of this program require the current hostname
     $uname=posix_uname();
@@ -38,7 +43,10 @@
     $Path = explode('/', preg_replace('/^\/+/',   '',    // Remove leading slashes
                          preg_replace('/[\s]+/', ' ',    // Convert extra whitespace
                                                          // Grab the path info from various different places.
-                             array_key_exists('PATH_INFO', $_SERVER)
+                          array_key_exists('ORIG_PATH_INFO', $_SERVER)
+                          && $_SERVER['ORIG_PATH_INFO']
+                           ? $_SERVER['ORIG_PATH_INFO']  
+	                   : (array_key_exists('PATH_INFO', $_SERVER)
                              && $_SERVER['PATH_INFO']
                                 ? $_SERVER['PATH_INFO']
                                 : (array_key_exists('PATH_INFO', $_ENV)
@@ -48,7 +56,7 @@
                                        ? $_GET['PATH_INFO']
                                        : ''
                                       )
-                                  )
+				   ))
                          ))
                    );
 
