Ticket #19796: 19796.4.diff
File 19796.4.diff, 23.5 KB (added by , 12 years ago) |
---|
-
wp-includes/link-template.php
1955 1955 * @return string Site url link with optional path appended. 1956 1956 */ 1957 1957 function get_site_url( $blog_id = null, $path = '', $scheme = null ) { 1958 if ( empty( $blog_id ) || !is_multisite() ) { 1959 $url = get_option( 'siteurl' ); 1958 if ( empty( $blog_id ) ) { 1959 if ( is_multisite() ) 1960 $url = get_option( 'home' ); 1961 else 1962 $url = get_option( 'siteurl' ); 1960 1963 } else { 1961 1964 switch_to_blog( $blog_id ); 1962 $url = get_option( ' siteurl' );1965 $url = get_option( 'home' ); 1963 1966 restore_current_blog(); 1964 1967 } 1965 1968 -
wp-includes/rewrite.php
1729 1729 <rewrite> 1730 1730 <rules>'; 1731 1731 } 1732 if ( !is_multisite() ) { 1733 $rules .= ' 1734 <rule name="wordpress" patternSyntax="Wildcard"> 1735 <match url="*" /> 1736 <conditions> 1737 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 1738 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 1739 </conditions> 1740 <action type="Rewrite" url="index.php" /> 1741 </rule>'; 1742 } else { 1743 if (is_subdomain_install()) { 1744 $rules .= ' 1745 <rule name="WordPress Rule 1" stopProcessing="true"> 1746 <match url="^index\.php$" ignoreCase="false" /> 1747 <action type="None" /> 1748 </rule>'; 1749 if ( get_site_option( 'ms_files_rewriting' ) ) { 1750 $rules .= ' 1751 <rule name="WordPress Rule for Files" stopProcessing="true"> 1752 <match url="^files/(.+)" ignoreCase="false" /> 1753 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> 1754 </rule>'; 1755 } 1756 $rules .= ' 1757 <rule name="WordPress Rule 2" stopProcessing="true"> 1758 <match url="^" ignoreCase="false" /> 1759 <conditions logicalGrouping="MatchAny"> 1760 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> 1761 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> 1732 1733 $rules .= ' 1734 <rule name="wordpress" patternSyntax="Wildcard"> 1735 <match url="*" /> 1736 <conditions> 1737 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 1738 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 1762 1739 </conditions> 1763 <action type="None" /> 1764 </rule> 1765 <rule name="WordPress Rule 3" stopProcessing="true"> 1766 <match url="." ignoreCase="false" /> 1767 <action type="Rewrite" url="index.php" /> 1768 </rule>'; 1769 } else { 1770 $rules .= ' 1771 <rule name="WordPress Rule 1" stopProcessing="true"> 1772 <match url="^index\.php$" ignoreCase="false" /> 1773 <action type="None" /> 1774 </rule>'; 1775 if ( get_site_option( 'ms_files_rewriting' ) ) { 1776 $rules .= ' 1777 <rule name="WordPress Rule for Files" stopProcessing="true"> 1778 <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" /> 1779 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" /> 1780 </rule>'; 1781 } 1782 $rules .= ' 1783 <rule name="WordPress Rule 2" stopProcessing="true"> 1784 <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> 1785 <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> 1786 </rule> 1787 <rule name="WordPress Rule 3" stopProcessing="true"> 1788 <match url="^" ignoreCase="false" /> 1789 <conditions logicalGrouping="MatchAny"> 1790 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> 1791 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> 1792 </conditions> 1793 <action type="None" /> 1794 </rule> 1795 <rule name="WordPress Rule 4" stopProcessing="true"> 1796 <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" /> 1797 <action type="Rewrite" url="{R:1}" /> 1798 </rule> 1799 <rule name="WordPress Rule 5" stopProcessing="true"> 1800 <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> 1801 <action type="Rewrite" url="{R:2}" /> 1802 </rule> 1803 <rule name="WordPress Rule 6" stopProcessing="true"> 1804 <match url="." ignoreCase="false" /> 1805 <action type="Rewrite" url="index.php" /> 1806 </rule>'; 1807 } 1808 } 1740 <action type="Rewrite" url="index.php" /> 1741 </rule>'; 1742 1809 1743 if ( $add_parent_tags ) { 1810 1744 $rules .= ' 1811 1745 </rules> -
wp-includes/canonical.php
517 517 site_url( 'dashboard', 'relative' ), 518 518 site_url( 'admin', 'relative' ), 519 519 ); 520 if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) {520 if ( parse_url( admin_url( '', 'relative' ), PHP_URL_PATH ) !== $_SERVER['REQUEST_URI'] && in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) { 521 521 wp_redirect( admin_url() ); 522 522 exit; 523 523 } -
wp-includes/ms-load.php
142 142 $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1; 143 143 $current_site->domain = DOMAIN_CURRENT_SITE; 144 144 $current_site->path = $path = PATH_CURRENT_SITE; 145 145 146 if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) 146 147 $current_site->blog_id = BLOG_ID_CURRENT_SITE; 147 148 elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) // deprecated. -
wp-includes/ms-settings.php
86 86 if ( '%siteurl%' == $destination ) 87 87 $destination = "http://" . $current_site->domain . $current_site->path; 88 88 } else { 89 $destination = 'http://' . $current_site->domain . $current_site-> path. 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );89 $destination = 'http://' . $current_site->domain . $current_site->wp_siteurl_subdir . 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain ); 90 90 } 91 91 header( 'Location: ' . $destination ); 92 92 die(); -
wp-includes/ms-functions.php
586 586 $mydomain = $blogname . '.' . preg_replace( '|^www\.|', '', $domain ); 587 587 $path = $base; 588 588 } else { 589 $mydomain = "$domain";590 $path = $base.$blogname.'/';589 $mydomain = $domain; 590 $path = '/' . join_with_slashes( $base, $blogname ) . '/'; 591 591 } 592 592 if ( domain_exists($mydomain, $path, $current_site->id) ) 593 593 $errors->add('blogname', __('Sorry, that site already exists!')); … … 1132 1132 die( __( '<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>' ) . '</body></html>' ); 1133 1133 $wpdb->suppress_errors( false ); 1134 1134 1135 $ url = get_blogaddress_by_id( $blog_id);1135 $homeurl = $siteurl = untrailingslashit( get_blogaddress_by_id( $blog_id ) ); 1136 1136 1137 1137 // Set everything up 1138 1138 make_db_current_silent( 'blog' ); … … 1140 1140 populate_roles(); 1141 1141 $wp_roles->_init(); 1142 1142 1143 $url = untrailingslashit( $url ); 1144 1145 update_option( 'siteurl', $url ); 1146 update_option( 'home', $url ); 1147 1143 update_option('siteurl', $siteurl); 1144 update_option('home', $homeurl); 1145 update_option('fileupload_url', join_with_slashes( $homeurl, 'files' ) ); 1148 1146 if ( get_site_option( 'ms_files_rewriting' ) ) 1149 1147 update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" ); 1150 1148 else 1151 1149 update_option( 'upload_path', get_blog_option( $current_site->blog_id, 'upload_path' ) ); 1150 update_option('blogname', stripslashes( $blog_title ) ); 1151 update_option('admin_email', ''); 1152 $wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') ); 1152 1153 1154 // remove all perms 1155 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix . 'user_level' ) ); 1156 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix . 'capabilities' ) ); 1157 1153 1158 update_option( 'blogname', stripslashes( $blog_title ) ); 1154 1159 update_option( 'admin_email', '' ); 1155 1160 -
wp-includes/functions.php
1473 1473 */ 1474 1474 function wp_upload_dir( $time = null ) { 1475 1475 $siteurl = get_option( 'siteurl' ); 1476 $homeurl = get_option( 'home' ); 1477 $baseurl = is_multisite() && defined( 'MULTISITE' ) ? $homeurl : $siteurl; 1476 1478 $upload_path = trim( get_option( 'upload_path' ) ); 1477 1478 if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) { 1479 $upload_path = trim($upload_path); 1480 $main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site(); 1481 if ( empty($upload_path) || 'wp-content/uploads' == $upload_path ) { 1479 1482 $dir = WP_CONTENT_DIR . '/uploads'; 1480 1483 } elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) { 1481 1484 // $dir is absolute, $upload_path is (maybe) relative to ABSPATH … … 1488 1491 if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) 1489 1492 $url = WP_CONTENT_URL . '/uploads'; 1490 1493 else 1491 $url = trailingslashit( $ siteurl ) . $upload_path;1494 $url = trailingslashit( $baseurl ) . $upload_path; 1492 1495 } 1493 1496 1494 1497 if ( defined( 'UPLOADS' ) ) { 1495 1498 $dir = ABSPATH . UPLOADS; 1496 $url = trailingslashit( $ siteurl ) . UPLOADS;1499 $url = trailingslashit( $baseurl ) . UPLOADS; 1497 1500 } 1498 1501 1499 1502 // Multisite (if not the main site in a post-MU network) -
wp-includes/formatting.php
1382 1382 } 1383 1383 1384 1384 /** 1385 * Removes trailing and leading strings from elements (array), then combines elements 1386 * with a string in between each element. Leading and trailing strings should be 1387 * manually concatenated. 1388 * 1389 * @since 3.5.0 1390 * 1391 * @param array $parts Items to be combined 1392 * @param string $string String to be used to combine items 1393 * @return string Concatenated parts with given strings in between each element. 1394 */ 1395 function join_with_string( $parts, $string ) { 1396 $members = array(); 1397 foreach ( (array) $parts as $part ) { 1398 if ( is_array( $part ) ) { 1399 foreach ( $part as $member ) { 1400 $members[] = trim( $member, $string ); 1401 } 1402 } else { 1403 $members[] = trim( $part, $string ); 1404 } 1405 } 1406 1407 return implode( $string, $members ); 1408 } 1409 1410 /** 1411 * Removes trailing and leading slashes from elements (array or string args), then combines elements 1412 * with a slash in between each element. Leading and trailing slashes should be 1413 * manually concatenated. 1414 * 1415 * @since 3.5.0 1416 * 1417 * @return string Concatenated string with slashes in between each element. 1418 */ 1419 function join_with_slashes() { 1420 $args = func_get_args(); 1421 return join_with_string( $args, '/' ); 1422 } 1423 1424 /** 1385 1425 * Adds slashes to escape strings. 1386 1426 * 1387 1427 * Slashes will first be removed if magic_quotes_gpc is set, see {@link -
wp-admin/network.php
51 51 * @return bool Whether subdomain install is allowed 52 52 */ 53 53 function allow_subdomain_install() { 54 $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( ' siteurl' ) );55 if( false !== strpos( $domain, '/' ) || 'localhost' == $domain || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $domain ) )54 $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) ); 55 if( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) 56 56 return false; 57 57 58 58 return true; … … 144 144 function network_step1( $errors = false ) { 145 145 global $is_apache; 146 146 147 if ( get_option( 'siteurl' ) != get_option( 'home' ) ) {148 echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . sprintf( __( 'Your <strong>WordPress address</strong> must match your <strong>Site address</strong> before creating a Network. See <a href="%s">General Settings</a>.' ), esc_url( admin_url( 'options-general.php' ) ) ) . '</p></div>';149 echo '</div>';150 include ( ABSPATH . 'wp-admin/admin-footer.php' );151 die();152 }153 154 147 if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) { 155 148 echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '</p></div>'; 156 149 echo '</div>'; … … 314 307 * @since 3.0.0 315 308 */ 316 309 function network_step2( $errors = false ) { 317 global $base, $wpdb; 318 $hostname = get_clean_basedomain(); 310 global $wpdb; 319 311 320 if ( ! isset( $base ) ) 321 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) ); 312 $hostname = get_clean_basedomain(); 313 $slashed_home = trailingslashit( get_option( 'home' ) ); 314 $slashed_siteurl = trailingslashit( get_option( 'siteurl' ) ); 315 $wp_siteurl_subdir = '/' . str_replace( $slashed_home, '', $slashed_siteurl ); 316 $rewrite_base = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : ''; 317 $base = parse_url( $slashed_home, PHP_URL_PATH ); 322 318 323 319 // Wildcard DNS message. 324 320 if ( is_wp_error( $errors ) ) … … 344 340 } 345 341 } 346 342 343 $subdir_match = $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?'; 344 $subdir_replacement_01 = $subdomain_install ? '' : '$1'; 345 $subdir_replacement_12 = $subdomain_install ? '$1' : '$2'; 346 347 347 if ( $_POST || ! is_multisite() ) { 348 348 ?> 349 349 <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3> … … 361 361 ?> 362 362 <ol> 363 363 <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>:' ), ABSPATH ); ?></p> 364 <textarea class="code" readonly="readonly" cols="100" rows=" 7">364 <textarea class="code" readonly="readonly" cols="100" rows="6"> 365 365 define('MULTISITE', true); 366 366 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>); 367 $base = '<?php echo $base; ?>';368 367 define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>'); 369 368 define('PATH_CURRENT_SITE', '<?php echo $base; ?>'); 370 369 define('SITE_ID_CURRENT_SITE', 1); 371 define('BLOG_ID_CURRENT_SITE', 1);</textarea> 370 define('BLOG_ID_CURRENT_SITE', 1); 371 </textarea> 372 372 <?php 373 373 $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' ); 374 374 foreach ( $keys_salts as $c => $v ) { 375 375 if ( defined( $c ) ) 376 376 unset( $keys_salts[ $c ] ); 377 377 } 378 378 379 if ( ! empty( $keys_salts ) ) { 379 380 $keys_salts_str = ''; 380 381 $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); … … 399 400 </li> 400 401 <?php 401 402 if ( iis7_supports_permalinks() ) : 403 // IIS doesn't support RewriteBase, all your RewriteBase are belong to us 404 $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match; 405 $iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base; 406 $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}'; 402 407 403 if ( $subdomain_install ) { 404 $web_config_file = 405 '<?xml version="1.0" encoding="UTF-8"?> 408 $web_config_file = <<<EOF 409 <?xml version="1.0" encoding="UTF-8"?> 406 410 <configuration> 407 411 <system.webServer> 408 412 <rewrite> … … 414 418 if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { 415 419 $web_config_file .= ' 416 420 <rule name="WordPress Rule for Files" stopProcessing="true"> 417 <match url="^ files/(.+)" ignoreCase="false" />418 <action type="Rewrite" url=" wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />421 <match url="^{$iis_subdir_match}files/(.+)" ignoreCase="false" /> 422 <action type="Rewrite" url="{$iis_rewrite_base}wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> 419 423 </rule>'; 420 424 } 421 425 $web_config_file .= ' 422 426 <rule name="WordPress Rule 2" stopProcessing="true"> 423 <match url="^" ignoreCase="false" /> 424 <conditions logicalGrouping="MatchAny"> 425 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> 426 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> 427 </conditions> 428 <action type="None" /> 427 <match url="^{$iis_subdir_match}wp-admin$" ignoreCase="false" /> 428 <action type="Redirect" url="{$iis_subdir_replacement}wp-admin/" redirectType="Permanent" /> 429 429 </rule> 430 430 <rule name="WordPress Rule 3" stopProcessing="true"> 431 <match url="." ignoreCase="false" />432 <action type="Rewrite" url="index.php" />433 </rule>434 </rules>435 </rewrite>436 </system.webServer>437 </configuration>';438 } else {439 $web_config_file =440 '<?xml version="1.0" encoding="UTF-8"?>441 <configuration>442 <system.webServer>443 <rewrite>444 <rules>445 <rule name="WordPress Rule 1" stopProcessing="true">446 <match url="^index\.php$" ignoreCase="false" />447 <action type="None" />448 </rule>';449 if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {450 $web_config_file .= '451 <rule name="WordPress Rule for Files" stopProcessing="true">452 <match url="^files/(.+)" ignoreCase="false" />453 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />454 </rule>';455 }456 $web_config_file .= '457 <rule name="WordPress Rule 2" stopProcessing="true">458 <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />459 <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />460 </rule>461 <rule name="WordPress Rule 3" stopProcessing="true">462 431 <match url="^" ignoreCase="false" /> 463 432 <conditions logicalGrouping="MatchAny"> 464 433 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> … … 467 436 <action type="None" /> 468 437 </rule> 469 438 <rule name="WordPress Rule 4" stopProcessing="true"> 470 <match url="^ [_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" />471 <action type="Rewrite" url="{ R:1}" />439 <match url="^{$iis_subdir_match}(wp-(content|admin|includes).*)" ignoreCase="false" /> 440 <action type="Rewrite" url="{$iis_rewrite_base}{R:1}" /> 472 441 </rule> 473 442 <rule name="WordPress Rule 5" stopProcessing="true"> 474 <match url="^ ([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />475 <action type="Rewrite" url="{ R:2}" />443 <match url="^{$iis_subdir_match}([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> 444 <action type="Rewrite" url="{$iis_rewrite_base}{R:2}" /> 476 445 </rule> 477 446 <rule name="WordPress Rule 6" stopProcessing="true"> 478 447 <match url="." ignoreCase="false" /> … … 481 450 </rules> 482 451 </rewrite> 483 452 </system.webServer> 484 </configuration>'; 485 } 453 </configuration> 454 EOF; 455 486 456 ?> 487 <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH); ?></p>457 <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), trailingslashit( str_replace( trailingslashit( $wp_siteurl_subdir ), '', ABSPATH ) ) ); ?></p> 488 458 <?php 489 459 if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) 490 460 echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; … … 495 465 496 466 <?php else : // end iis7_supports_permalinks(). construct an htaccess file instead: 497 467 498 $htaccess_file = 'RewriteEngine On 499 RewriteBase ' . $base . ' 500 RewriteRule ^index\.php$ - [L]' . "\n"; 501 468 $ms_files_rewriting = ''; 502 469 if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { 503 $ htaccess_file .= "\n# uploaded files\nRewriteRule ^";504 $ htaccess_file .= ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]'. "\n";470 $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^"; 471 $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}wp-includes/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; 505 472 } 506 473 507 if ( ! $subdomain_install ) 508 $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n"; 474 $htaccess_file = <<<EOF 475 RewriteEngine On 476 RewriteBase {$base} 477 RewriteRule ^index\.php$ - [L] 478 {$ms_files_rewriting} 479 # add a trailing slash to /wp-admin 480 RewriteRule ^{$subdir_match}wp-admin$ {$subdir_replacement_01}wp-admin/ [R=301,L] 509 481 510 $htaccess_file .= "\n" . 'RewriteCond %{REQUEST_FILENAME} -f [OR]482 RewriteCond %{REQUEST_FILENAME} -f [OR] 511 483 RewriteCond %{REQUEST_FILENAME} -d 512 RewriteRule ^ - [L]'; 484 RewriteRule ^ - [L] 485 RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}{$subdir_replacement_12} [L] 486 RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L] 487 RewriteRule . index.php [L] 488 EOF; 513 489 514 // @todo custom content dir.515 if ( ! $subdomain_install )516 $htaccess_file .= "\nRewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]\nRewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]";517 518 $htaccess_file .= "\nRewriteRule . index.php [L]";519 520 490 ?> 521 491 <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> 522 492 <?php … … 537 507 538 508 if ( $_POST ) { 539 509 540 $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) );541 542 510 check_admin_referer( 'install-network-1' ); 543 511 544 512 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 545 513 // create network tables 546 514 install_network(); 547 $ hostname = get_clean_basedomain();515 $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH ); 548 516 $subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false; 549 517 if ( ! network_domain_check() ) { 550 518 $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install ); -
wp-admin/network/site-new.php
62 62 63 63 if ( is_subdomain_install() ) { 64 64 $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); 65 $path = $base;65 $path = $current_site->path; 66 66 } else { 67 67 $newdomain = $current_site->domain; 68 $path = $base. $domain . '/';68 $path = $current_site->path . $domain . '/'; 69 69 } 70 70 71 71 $password = 'N/A';