- if ( ! isset( $base ) )
- $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );
+ $hostname = get_clean_basedomain();
+ $slashed_home = trailingslashit( get_option( 'home' ) );
+ $base = parse_url( $slashed_home, PHP_URL_PATH );
+ $document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
+ $abspath_fix = str_replace( '\\', '/', ABSPATH );
+ $home_path = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
+ $wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
+ $rewrite_base = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
+
+
+ $location_of_wp_config = $abspath_fix;
+ if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {
+ $location_of_wp_config = dirname( $abspath_fix );
+ }
+ $location_of_wp_config = trailingslashit( $location_of_wp_config );