Skip to content

Commit 66aa532

Browse files
committed
When the WordPress files are in a subdirectory, correctly redirect the user to the setup-config.php page from the parent directories index.php. Fixes #24480
git-svn-id: https://develop.svn.wordpress.org/trunk@25385 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f987714 commit 66aa532

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

src/wp-load.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@
3737

3838
// A config file doesn't exist
3939

40-
// Set a path for the link to the installer
41-
if ( strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false )
42-
$path = 'setup-config.php';
43-
else
44-
$path = 'wp-admin/setup-config.php';
45-
4640
define( 'WPINC', 'wp-includes' );
4741
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
4842
require_once( ABSPATH . WPINC . '/load.php' );
@@ -51,8 +45,21 @@
5145
wp_check_php_mysql_versions();
5246
wp_load_translations_early();
5347

48+
// Standardize $_SERVER variables across setups.
49+
wp_fix_server_vars();
50+
5451
require_once( ABSPATH . WPINC . '/functions.php' );
5552

53+
// Set a path for the link to the installer
54+
if ( strpos( $_SERVER['PHP_SELF'], 'wp-admin' ) !== false ) {
55+
$path = 'setup-config.php';
56+
} elseif ( file_exists( dirname( $_SERVER['SCRIPT_FILENAME'] ) . '/wp-admin/setup-config.php' ) ) {
57+
$path = 'wp-admin/setup-config.php';
58+
} else {
59+
// WordPress files are in a sub directory, and the user is hitting the index.php in the parent directory
60+
$path = str_replace( dirname( $_SERVER['SCRIPT_FILENAME'] ) . '/', '', dirname( __FILE__ ) . '/wp-admin/setup-config.php' );
61+
}
62+
5663
// Die with an error message
5764
$die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';
5865
$die .= '<p>' . __( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>';

0 commit comments

Comments
 (0)