Changeset 34023 for trunk/src/wp-admin/network.php
- Timestamp:
- 09/10/2015 10:00:58 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/network.php
r32974 r34023 16 16 require_once( dirname( __FILE__ ) . '/admin.php' ); 17 17 18 if ( ! is_super_admin() ) 18 if ( ! is_super_admin() ) { 19 19 wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); 20 } 20 21 21 22 if ( is_multisite() ) { … … 24 25 exit; 25 26 } 26 if ( ! defined( 'MULTISITE' ) ) 27 28 if ( ! defined( 'MULTISITE' ) ) { 27 29 wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) ); 30 } 28 31 } 29 32 33 require_once( dirname( __FILE__ ) . '/includes/network.php' ); 34 30 35 // We need to create references to ms global tables to enable Network. 31 foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) 36 foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) { 32 37 $wpdb->$table = $prefixed_table; 33 34 /**35 * Check for an existing network.36 *37 * @since 3.0.038 *39 * @global wpdb $wpdb40 *41 * @return Whether a network exists.42 */43 function network_domain_check() {44 global $wpdb;45 46 $sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) );47 if ( $wpdb->get_var( $sql ) ) {48 return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" );49 }50 return false;51 38 } 52 39 53 /** 54 * Allow subdomain install 55 * 56 * @since 3.0.0 57 * @return bool Whether subdomain install is allowed 58 */ 59 function allow_subdomain_install() { 60 $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) ); 61 if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) 62 return false; 63 64 return true; 40 if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) { 41 wp_die( __( 'You must define the <code>WP_ALLOW_MULTISITE</code> constant as true in your wp-config.php file to allow creation of a Network.' ) ); 65 42 } 66 /**67 * Allow subdirectory install.68 *69 * @since 3.0.070 *71 * @global wpdb $wpdb72 *73 * @return bool Whether subdirectory install is allowed74 */75 function allow_subdirectory_install() {76 global $wpdb;77 /**78 * Filter whether to enable the subdirectory install feature in Multisite.79 *80 * @since 3.0.081 *82 * @param bool true Whether to enable the subdirectory install feature in Multisite. Default is false.83 */84 if ( apply_filters( 'allow_subdirectory_install', false ) )85 return true;86 87 if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL )88 return true;89 90 $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" );91 if ( empty( $post ) )92 return true;93 94 return false;95 }96 /**97 * Get base domain of network.98 *99 * @since 3.0.0100 * @return string Base domain.101 */102 function get_clean_basedomain() {103 if ( $existing_domain = network_domain_check() )104 return $existing_domain;105 $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );106 if ( $slash = strpos( $domain, '/' ) )107 $domain = substr( $domain, 0, $slash );108 return $domain;109 }110 111 if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) )112 wp_die( __( 'You must define the <code>WP_ALLOW_MULTISITE</code> constant as true in your wp-config.php file to allow creation of a Network.' ) );113 43 114 44 if ( is_network_admin() ) { … … 149 79 150 80 <?php 151 /**152 * Prints step 1 for Network installation process.153 *154 * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network155 * should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo.156 *157 * @since 3.0.0158 *159 * @global bool $is_apache160 *161 * @param WP_Error $errors162 */163 function network_step1( $errors = false ) {164 global $is_apache;165 166 if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) {167 echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '</p></div>';168 echo '</div>';169 include( ABSPATH . 'wp-admin/admin-footer.php' );170 die();171 }172 173 $active_plugins = get_option( 'active_plugins' );174 if ( ! empty( $active_plugins ) ) {175 echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf( __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '</p></div><p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';176 echo '</div>';177 include( ABSPATH . 'wp-admin/admin-footer.php' );178 die();179 }180 181 $hostname = get_clean_basedomain();182 $has_ports = strstr( $hostname, ':' );183 if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) {184 echo '<div class="error"><p><strong>' . __( 'ERROR:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';185 echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>';186 echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>';187 echo '</div>';188 include( ABSPATH . 'wp-admin/admin-footer.php' );189 die();190 }191 192 echo '<form method="post">';193 194 wp_nonce_field( 'install-network-1' );195 196 $error_codes = array();197 if ( is_wp_error( $errors ) ) {198 echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>';199 foreach ( $errors->get_error_messages() as $error )200 echo "<p>$error</p>";201 echo '</div>';202 $error_codes = $errors->get_error_codes();203 }204 205 $site_name = ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) ? $_POST['sitename'] : sprintf( _x('%s Sites', 'Default network name' ), get_option( 'blogname' ) );206 $admin_email = ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) ? $_POST['email'] : get_option( 'admin_email' );207 ?>208 <p><?php _e( 'Welcome to the Network installation process!' ); ?></p>209 <p><?php _e( 'Fill in the information below and you’ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.' ); ?></p>210 <?php211 212 if ( isset( $_POST['subdomain_install'] ) ) {213 $subdomain_install = (bool) $_POST['subdomain_install'];214 } elseif ( apache_mod_loaded('mod_rewrite') ) { // assume nothing215 $subdomain_install = true;216 } elseif ( !allow_subdirectory_install() ) {217 $subdomain_install = true;218 } else {219 $subdomain_install = false;220 if ( $got_mod_rewrite = got_mod_rewrite() ) // dangerous assumptions221 echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ' . __( 'Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.' ) . '</p>';222 elseif ( $is_apache )223 echo '<div class="error inline"><p><strong>' . __( 'Warning!' ) . '</strong> ' . __( 'It looks like the Apache <code>mod_rewrite</code> module is not installed.' ) . '</p>';224 if ( $got_mod_rewrite || $is_apache ) // Protect against mod_rewrite mimicry (but ! Apache)225 echo '<p>' . __( 'If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.' ) . '</p></div>';226 }227 228 if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?>229 <h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3>230 <p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>' ); ?></p>231 <p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p>232 <?php // @todo: Link to an MS readme? ?>233 <table class="form-table">234 <tr>235 <th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>236 <td><?php printf(237 /* translators: 1: hostname */238 _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ),239 $hostname240 ); ?></td>241 </tr>242 <tr>243 <th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th>244 <td><?php printf(245 /* translators: 1: hostname */246 _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ),247 $hostname248 ); ?></td>249 </tr>250 </table>251 252 <?php253 endif;254 255 if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) )256 echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';257 258 $is_www = ( 0 === strpos( $hostname, 'www.' ) );259 if ( $is_www ) :260 ?>261 <h3><?php esc_html_e( 'Server Address' ); ?></h3>262 <p><?php printf( __( 'We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.' ), substr( $hostname, 4 ), $hostname ); ?></p>263 <table class="form-table">264 <tr>265 <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>266 <td>267 <?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?>268 </td>269 </tr>270 </table>271 <?php endif; ?>272 273 <h3><?php esc_html_e( 'Network Details' ); ?></h3>274 <table class="form-table">275 <?php if ( 'localhost' == $hostname ) : ?>276 <tr>277 <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th>278 <td><?php279 _e( 'Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.' );280 // Uh oh:281 if ( !allow_subdirectory_install() )282 echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';283 ?></td>284 </tr>285 <?php elseif ( !allow_subdomain_install() ) : ?>286 <tr>287 <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th>288 <td><?php289 _e( 'Because your install is in a directory, the sites in your WordPress network must use sub-directories.' );290 // Uh oh:291 if ( !allow_subdirectory_install() )292 echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';293 ?></td>294 </tr>295 <?php elseif ( !allow_subdirectory_install() ) : ?>296 <tr>297 <th scope="row"><?php esc_html_e( 'Sub-domain Install' ); ?></th>298 <td><?php _e( 'Because your install is not new, the sites in your WordPress network must use sub-domains.' );299 echo ' <strong>' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';300 ?></td>301 </tr>302 <?php endif; ?>303 <?php if ( ! $is_www ) : ?>304 <tr>305 <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>306 <td>307 <?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?>308 </td>309 </tr>310 <?php endif; ?>311 <tr>312 <th scope='row'><?php esc_html_e( 'Network Title' ); ?></th>313 <td>314 <input name='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' />315 <p class="description">316 <?php _e( 'What would you like to call your network?' ); ?>317 </p>318 </td>319 </tr>320 <tr>321 <th scope='row'><?php esc_html_e( 'Network Admin Email' ); ?></th>322 <td>323 <input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' />324 <p class="description">325 <?php _e( 'Your email address.' ); ?>326 </p>327 </td>328 </tr>329 </table>330 <?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?>331 </form>332 <?php333 }334 335 /**336 * Prints step 2 for Network installation process.337 *338 * @since 3.0.0339 *340 * @global wpdb $wpdb341 *342 * @param WP_Error $errors343 */344 function network_step2( $errors = false ) {345 global $wpdb;346 347 $hostname = get_clean_basedomain();348 $slashed_home = trailingslashit( get_option( 'home' ) );349 $base = parse_url( $slashed_home, PHP_URL_PATH );350 $document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );351 $abspath_fix = str_replace( '\\', '/', ABSPATH );352 $home_path = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();353 $wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );354 $rewrite_base = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';355 356 357 $location_of_wp_config = $abspath_fix;358 if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {359 $location_of_wp_config = dirname( $abspath_fix );360 }361 $location_of_wp_config = trailingslashit( $location_of_wp_config );362 363 // Wildcard DNS message.364 if ( is_wp_error( $errors ) )365 echo '<div class="error">' . $errors->get_error_message() . '</div>';366 367 if ( $_POST ) {368 if ( allow_subdomain_install() )369 $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;370 else371 $subdomain_install = false;372 } else {373 if ( is_multisite() ) {374 $subdomain_install = is_subdomain_install();375 ?>376 <p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>377 <?php378 } else {379 $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );380 ?>381 <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>382 <p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p>383 <?php384 }385 }386 387 $subdir_match = $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?';388 $subdir_replacement_01 = $subdomain_install ? '' : '$1';389 $subdir_replacement_12 = $subdomain_install ? '$1' : '$2';390 391 if ( $_POST || ! is_multisite() ) {392 ?>393 <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>394 <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>395 <div class="updated inline"><p><?php396 if ( file_exists( $home_path . '.htaccess' ) )397 printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), '.htaccess' );398 elseif ( file_exists( $home_path . 'web.config' ) )399 printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), 'web.config' );400 else401 _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );402 ?></p></div>403 <?php404 }405 ?>406 <ol>407 <li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That’s all, stop editing! Happy blogging. */</code>:' ), $location_of_wp_config ); ?></p>408 <textarea class="code" readonly="readonly" cols="100" rows="7">409 define('MULTISITE', true);410 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>);411 define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>');412 define('PATH_CURRENT_SITE', '<?php echo $base; ?>');413 define('SITE_ID_CURRENT_SITE', 1);414 define('BLOG_ID_CURRENT_SITE', 1);415 </textarea>416 <?php417 $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' );418 foreach ( $keys_salts as $c => $v ) {419 if ( defined( $c ) )420 unset( $keys_salts[ $c ] );421 }422 423 if ( ! empty( $keys_salts ) ) {424 $keys_salts_str = '';425 $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );426 if ( is_wp_error( $from_api ) ) {427 foreach ( $keys_salts as $c => $v ) {428 $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );";429 }430 } else {431 $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) );432 foreach ( $keys_salts as $c => $v ) {433 $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";434 }435 }436 $num_keys_salts = count( $keys_salts );437 ?>438 <p>439 <?php440 if ( 1 == $num_keys_salts ) {441 _e( 'This unique authentication key is also missing from your <code>wp-config.php</code> file.' );442 } else {443 _e( 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.' );444 }445 ?>446 <?php _e( 'To make your installation more secure, you should also add:' ); ?>447 </p>448 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>449 <?php450 }451 ?>452 </li>453 <?php454 if ( iis7_supports_permalinks() ) :455 // IIS doesn't support RewriteBase, all your RewriteBase are belong to us456 $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match;457 $iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base;458 $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}';459 460 $web_config_file = '<?xml version="1.0" encoding="UTF-8"?>461 <configuration>462 <system.webServer>463 <rewrite>464 <rules>465 <rule name="WordPress Rule 1" stopProcessing="true">466 <match url="^index\.php$" ignoreCase="false" />467 <action type="None" />468 </rule>';469 if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {470 $web_config_file .= '471 <rule name="WordPress Rule for Files" stopProcessing="true">472 <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" />473 <action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" />474 </rule>';475 }476 $web_config_file .= '477 <rule name="WordPress Rule 2" stopProcessing="true">478 <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" />479 <action type="Redirect" url="' . $iis_subdir_replacement . 'wp-admin/" redirectType="Permanent" />480 </rule>481 <rule name="WordPress Rule 3" stopProcessing="true">482 <match url="^" ignoreCase="false" />483 <conditions logicalGrouping="MatchAny">484 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />485 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />486 </conditions>487 <action type="None" />488 </rule>489 <rule name="WordPress Rule 4" stopProcessing="true">490 <match url="^' . $iis_subdir_match . '(wp-(content|admin|includes).*)" ignoreCase="false" />491 <action type="Rewrite" url="' . $iis_rewrite_base . '{R:1}" />492 </rule>493 <rule name="WordPress Rule 5" stopProcessing="true">494 <match url="^' . $iis_subdir_match . '([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />495 <action type="Rewrite" url="' . $iis_rewrite_base . '{R:2}" />496 </rule>497 <rule name="WordPress Rule 6" stopProcessing="true">498 <match url="." ignoreCase="false" />499 <action type="Rewrite" url="index.php" />500 </rule>501 </rules>502 </rewrite>503 </system.webServer>504 </configuration>505 ';506 507 echo '<li><p>';508 /* translators: 1: a filename like .htaccess. 2: a file path. */509 printf( __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),510 '<code>web.config</code>', '<code>' . $home_path . '</code>' );511 echo '</p>';512 if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )513 echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';514 ?>515 <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?>516 </textarea></li>517 </ol>518 519 <?php else : // end iis7_supports_permalinks(). construct an htaccess file instead:520 521 $ms_files_rewriting = '';522 if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {523 $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^";524 $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";525 }526 527 $htaccess_file = <<<EOF528 RewriteEngine On529 RewriteBase {$base}530 RewriteRule ^index\.php$ - [L]531 {$ms_files_rewriting}532 # add a trailing slash to /wp-admin533 RewriteRule ^{$subdir_match}wp-admin$ {$subdir_replacement_01}wp-admin/ [R=301,L]534 535 RewriteCond %{REQUEST_FILENAME} -f [OR]536 RewriteCond %{REQUEST_FILENAME} -d537 RewriteRule ^ - [L]538 RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}{$subdir_replacement_12} [L]539 RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L]540 RewriteRule . index.php [L]541 542 EOF;543 544 echo '<li><p>';545 /* translators: 1: a filename like .htaccess. 2: a file path. */546 printf( __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),547 '<code>.htaccess</code>', '<code>' . $home_path . '</code>' );548 echo '</p>';549 if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )550 echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';551 ?>552 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>">553 <?php echo esc_textarea( $htaccess_file ); ?></textarea></li>554 </ol>555 556 <?php endif; // end IIS/Apache code branches.557 558 if ( !is_multisite() ) { ?>559 <p><?php _e( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.' ); ?> <a href="<?php echo esc_url( site_url( 'wp-login.php' ) ); ?>"><?php _e( 'Log In' ); ?></a></p>560 <?php561 }562 }563 564 81 if ( $_POST ) { 565 82
Note: See TracChangeset
for help on using the changeset viewer.