Index: wp-admin/network.php
===================================================================
--- wp-admin/network.php	(revision 23284)
+++ wp-admin/network.php	(working copy)
@@ -309,15 +309,20 @@
 function network_step2( $errors = false ) {
 	global $wpdb;
 
+	$home_path         = get_home_path();
 	$hostname          = get_clean_basedomain();
 	$slashed_home      = trailingslashit( get_option( 'home' ) );
 	$base              = parse_url( $slashed_home, PHP_URL_PATH );
-	$wp_dir_from_root  = preg_replace( '#^' . preg_quote( $_SERVER['DOCUMENT_ROOT'], '#' ) . '#', '', ABSPATH );
-	$wp_siteurl_subdir = trailingslashit( '/' . preg_replace( '#^' . preg_quote( $base, '#' ) . '#', '', $wp_dir_from_root ) );
+	$document_root     = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
+	$sanitized_abspath = str_replace( '\\', '/', ABSPATH );
+	if ( false !== strpos( $sanitized_abspath, $document_root ) ) {
+		$wp_dir_from_root  = preg_replace( '#^' . preg_quote( $document_root, '#' ) . '#', '', $sanitized_abspath );
+		$wp_siteurl_subdir = trailingslashit( '/' . preg_replace( '#^' . preg_quote( $base, '#' ) . '#', '', $wp_dir_from_root ) );
+	} else {
+		$wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', ABSPATH );
+	}
 	$rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
 
-	$home_path         = get_home_path();
-
 	$location_of_wp_config = ABSPATH;
 	if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) )
 		$location_of_wp_config = trailingslashit( dirname( ABSPATH ) );
