| 1 | Index: wp-admin/network.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/network.php (revision 14868) |
|---|
| 4 | +++ wp-admin/network.php (working copy) |
|---|
| 5 | @@ -336,35 +336,119 @@ |
|---|
| 6 | ?> |
|---|
| 7 | </li> |
|---|
| 8 | <?php |
|---|
| 9 | -// Construct an htaccess file. |
|---|
| 10 | -$htaccess_file = 'RewriteEngine On |
|---|
| 11 | -RewriteBase ' . $base . ' |
|---|
| 12 | -RewriteRule ^index\.php$ - [L] |
|---|
| 13 | - |
|---|
| 14 | -# uploaded files |
|---|
| 15 | -RewriteRule ^' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n"; |
|---|
| 16 | - |
|---|
| 17 | -if ( ! $subdomain_install ) |
|---|
| 18 | - $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n"; |
|---|
| 19 | - |
|---|
| 20 | -$htaccess_file .= "\n" . 'RewriteCond %{REQUEST_FILENAME} -f [OR] |
|---|
| 21 | -RewriteCond %{REQUEST_FILENAME} -d |
|---|
| 22 | -RewriteRule ^ - [L]'; |
|---|
| 23 | - |
|---|
| 24 | -// @todo custom content dir. |
|---|
| 25 | -if ( ! $subdomain_install ) |
|---|
| 26 | - $htaccess_file .= "\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] |
|---|
| 27 | -RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]'; |
|---|
| 28 | - |
|---|
| 29 | -$htaccess_file .= "\nRewriteRule . index.php [L]"; |
|---|
| 30 | - |
|---|
| 31 | -?> |
|---|
| 32 | - <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> |
|---|
| 33 | - <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>"> |
|---|
| 34 | -<?php echo wp_htmledit_pre( $htaccess_file ); ?> |
|---|
| 35 | -</textarea></li> |
|---|
| 36 | + if (iis7_supports_permalinks()) { |
|---|
| 37 | + if (is_subdomain_install()) { |
|---|
| 38 | + $web_config_file = |
|---|
| 39 | +'<?xml version="1.0" encoding="UTF-8"?> |
|---|
| 40 | +<configuration> |
|---|
| 41 | + <system.webServer> |
|---|
| 42 | + <rewrite> |
|---|
| 43 | + <rules> |
|---|
| 44 | + <rule name="WordPress Rule 1" stopProcessing="true"> |
|---|
| 45 | + <match url="^index\.php$" ignoreCase="false" /> |
|---|
| 46 | + <action type="None" /> |
|---|
| 47 | + </rule> |
|---|
| 48 | + <rule name="WordPress Rule 2" stopProcessing="true"> |
|---|
| 49 | + <match url="^files/(.+)" ignoreCase="false" /> |
|---|
| 50 | + <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> |
|---|
| 51 | + </rule> |
|---|
| 52 | + <rule name="WordPress Rule 3" stopProcessing="true"> |
|---|
| 53 | + <match url="^" ignoreCase="false" /> |
|---|
| 54 | + <conditions logicalGrouping="MatchAny"> |
|---|
| 55 | + <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> |
|---|
| 56 | + <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> |
|---|
| 57 | + </conditions> |
|---|
| 58 | + <action type="None" /> |
|---|
| 59 | + </rule> |
|---|
| 60 | + <rule name="WordPress Rule 4" stopProcessing="true"> |
|---|
| 61 | + <match url="." ignoreCase="false" /> |
|---|
| 62 | + <action type="Rewrite" url="index.php" /> |
|---|
| 63 | + </rule> |
|---|
| 64 | + </rules> |
|---|
| 65 | + </rewrite> |
|---|
| 66 | + </system.webServer> |
|---|
| 67 | +</configuration>'; |
|---|
| 68 | + } else { |
|---|
| 69 | + $web_config_file = |
|---|
| 70 | +'<?xml version="1.0" encoding="UTF-8"?> |
|---|
| 71 | +<configuration> |
|---|
| 72 | + <system.webServer> |
|---|
| 73 | + <rewrite> |
|---|
| 74 | + <rules> |
|---|
| 75 | + <rule name="WordPress Rule 1" stopProcessing="true"> |
|---|
| 76 | + <match url="^index\.php$" ignoreCase="false" /> |
|---|
| 77 | + <action type="None" /> |
|---|
| 78 | + </rule> |
|---|
| 79 | + <rule name="WordPress Rule 2" stopProcessing="true"> |
|---|
| 80 | + <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" /> |
|---|
| 81 | + <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" /> |
|---|
| 82 | + </rule> |
|---|
| 83 | + <rule name="WordPress Rule 3" stopProcessing="true"> |
|---|
| 84 | + <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> |
|---|
| 85 | + <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> |
|---|
| 86 | + </rule> |
|---|
| 87 | + <rule name="WordPress Rule 4" stopProcessing="true"> |
|---|
| 88 | + <match url="^" ignoreCase="false" /> |
|---|
| 89 | + <conditions logicalGrouping="MatchAny"> |
|---|
| 90 | + <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> |
|---|
| 91 | + <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> |
|---|
| 92 | + </conditions> |
|---|
| 93 | + <action type="None" /> |
|---|
| 94 | + </rule> |
|---|
| 95 | + <rule name="WordPress Rule 5" stopProcessing="true"> |
|---|
| 96 | + <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" /> |
|---|
| 97 | + <action type="Rewrite" url="{R:2}" /> |
|---|
| 98 | + </rule> |
|---|
| 99 | + <rule name="WordPress Rule 6" stopProcessing="true"> |
|---|
| 100 | + <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> |
|---|
| 101 | + <action type="Rewrite" url="{R:2}" /> |
|---|
| 102 | + </rule> |
|---|
| 103 | + <rule name="WordPress Rule 7" stopProcessing="true"> |
|---|
| 104 | + <match url="." ignoreCase="false" /> |
|---|
| 105 | + <action type="Rewrite" url="index.php" /> |
|---|
| 106 | + </rule> |
|---|
| 107 | + </rules> |
|---|
| 108 | + </rewrite> |
|---|
| 109 | + </system.webServer> |
|---|
| 110 | +</configuration>'; |
|---|
| 111 | + } |
|---|
| 112 | + ?> |
|---|
| 113 | + <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> |
|---|
| 114 | + <textarea class="code" readonly="readonly" cols="100" rows="20"> |
|---|
| 115 | + <?php echo wp_htmledit_pre( $web_config_file ); ?> |
|---|
| 116 | + </textarea></li> |
|---|
| 117 | </ol> |
|---|
| 118 | -<?php if ( !is_multisite() ) { ?> |
|---|
| 119 | + <?php } else { |
|---|
| 120 | + // Construct an htaccess file. |
|---|
| 121 | + $htaccess_file = 'RewriteEngine On |
|---|
| 122 | + RewriteBase ' . $base . ' |
|---|
| 123 | + RewriteRule ^index\.php$ - [L] |
|---|
| 124 | + |
|---|
| 125 | + # uploaded files |
|---|
| 126 | + RewriteRule ^' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n"; |
|---|
| 127 | + |
|---|
| 128 | + if ( ! $subdomain_install ) |
|---|
| 129 | + $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n"; |
|---|
| 130 | + |
|---|
| 131 | + $htaccess_file .= "\n" . 'RewriteCond %{REQUEST_FILENAME} -f [OR] |
|---|
| 132 | + RewriteCond %{REQUEST_FILENAME} -d |
|---|
| 133 | + RewriteRule ^ - [L]'; |
|---|
| 134 | + |
|---|
| 135 | + // @todo custom content dir. |
|---|
| 136 | + if ( ! $subdomain_install ) |
|---|
| 137 | + $htaccess_file .= "\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] |
|---|
| 138 | + RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]'; |
|---|
| 139 | + |
|---|
| 140 | + $htaccess_file .= "\nRewriteRule . index.php [L]"; |
|---|
| 141 | + |
|---|
| 142 | + ?> |
|---|
| 143 | + <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> |
|---|
| 144 | + <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>"> |
|---|
| 145 | + <?php echo wp_htmledit_pre( $htaccess_file ); ?> |
|---|
| 146 | + </textarea></li> |
|---|
| 147 | + </ol> |
|---|
| 148 | + <?php } |
|---|
| 149 | + if ( !is_multisite() ) { ?> |
|---|
| 150 | <p><?php printf( __( '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> |
|---|
| 151 | <?php |
|---|
| 152 | } |
|---|
| 153 | Index: wp-includes/ms-functions.php |
|---|
| 154 | =================================================================== |
|---|
| 155 | --- wp-includes/ms-functions.php (revision 14868) |
|---|
| 156 | +++ wp-includes/ms-functions.php (working copy) |
|---|
| 157 | @@ -1302,7 +1302,7 @@ |
|---|
| 158 | |
|---|
| 159 | function maybe_redirect_404() { |
|---|
| 160 | global $current_site; |
|---|
| 161 | - if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = NOBLOGREDIRECT ) ) { |
|---|
| 162 | + if ( !is_subdomain_install() && is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = NOBLOGREDIRECT ) ) { |
|---|
| 163 | if ( $destination == '%siteurl%' ) |
|---|
| 164 | $destination = network_home_url(); |
|---|
| 165 | wp_redirect( $destination ); |
|---|
| 166 | Index: wp-includes/rewrite.php |
|---|
| 167 | =================================================================== |
|---|
| 168 | --- wp-includes/rewrite.php (revision 14868) |
|---|
| 169 | +++ wp-includes/rewrite.php (working copy) |
|---|
| 170 | @@ -1757,10 +1757,16 @@ |
|---|
| 171 | |
|---|
| 172 | if ( ! $this->using_permalinks() ) |
|---|
| 173 | return ''; |
|---|
| 174 | - |
|---|
| 175 | + $rules = ''; |
|---|
| 176 | + $extra_indent = ''; |
|---|
| 177 | + if ( $add_parent_tags ) { |
|---|
| 178 | + $rules .= "<configuration>".$end_of_line; |
|---|
| 179 | + $rules .= $indent."<system.webServer>".$end_of_line; |
|---|
| 180 | + $rules .= $indent.$indent."<rewrite>".$end_of_line; |
|---|
| 181 | + $rules .= $indent.$indent.$indent."<rules>".$end_of_line; |
|---|
| 182 | + $extra_indent = $indent.$indent.$indent.$indent; |
|---|
| 183 | + } |
|---|
| 184 | if ( !is_multisite() ) { |
|---|
| 185 | - $rules = ''; |
|---|
| 186 | - $extra_indent = ''; |
|---|
| 187 | if ( $add_parent_tags ) { |
|---|
| 188 | $rules .= "<configuration>".$end_of_line; |
|---|
| 189 | $rules .= $indent."<system.webServer>".$end_of_line; |
|---|
| 190 | @@ -1778,63 +1784,69 @@ |
|---|
| 191 | $rules .= $extra_indent.$indent."<action type=\"Rewrite\" url=\"index.php\" />".$end_of_line; |
|---|
| 192 | $rules .= $extra_indent."</rule>"; |
|---|
| 193 | |
|---|
| 194 | - if ( $add_parent_tags ) { |
|---|
| 195 | - $rules .= $end_of_line.$indent.$indent.$indent."</rules>".$end_of_line; |
|---|
| 196 | - $rules .= $indent.$indent."</rewrite>".$end_of_line; |
|---|
| 197 | - $rules .= $indent."</system.webServer>".$end_of_line; |
|---|
| 198 | - $rules .= "</configuration>"; |
|---|
| 199 | + } else { |
|---|
| 200 | + if (is_subdomain_install()) { |
|---|
| 201 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 1\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 202 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\"^index\.php$\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 203 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"None\" />".$end_of_line; |
|---|
| 204 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 205 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 2\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 206 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\"^files/(.+)\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 207 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"Rewrite\" url=\"wp-includes/ms-files.php?file={R:1}\" appendQueryString=\"false\" />".$end_of_line; |
|---|
| 208 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 209 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 3\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 210 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\"^\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 211 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<conditions logicalGrouping=\"MatchAny\">".$end_of_line; |
|---|
| 212 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 213 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 214 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."</conditions>".$end_of_line; |
|---|
| 215 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"None\" />".$end_of_line; |
|---|
| 216 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 217 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 4\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 218 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\".\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 219 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"Rewrite\" url=\"index.php\" />".$end_of_line; |
|---|
| 220 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 221 | + } else { |
|---|
| 222 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 1\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 223 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\"^index\.php$\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 224 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"None\" />".$end_of_line; |
|---|
| 225 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 226 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 2\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 227 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\"^([_0-9a-zA-Z-]+/)?files/(.+)\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 228 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"Rewrite\" url=\"wp-includes/ms-files.php?file={R:2}\" appendQueryString=\"false\" />".$end_of_line; |
|---|
| 229 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 230 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 3\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 231 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\"^([_0-9a-zA-Z-]+/)?wp-admin$\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 232 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"Redirect\" url=\"{R:1}wp-admin/\" redirectType=\"Permanent\" />".$end_of_line; |
|---|
| 233 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 234 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 4\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 235 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\"^\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 236 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<conditions logicalGrouping=\"MatchAny\">".$end_of_line; |
|---|
| 237 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 238 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 239 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."</conditions>".$end_of_line; |
|---|
| 240 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"None\" />".$end_of_line; |
|---|
| 241 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 242 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 5\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 243 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\"^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 244 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"Rewrite\" url=\"{R:2}\" />".$end_of_line; |
|---|
| 245 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 246 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 6\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 247 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\"^([_0-9a-zA-Z-]+/)?(.*\.php)$\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 248 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"Rewrite\" url=\"{R:2}\" />".$end_of_line; |
|---|
| 249 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 250 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."<rule name=\"wordpress - Rule 7\" stopProcessing=\"true\">".$end_of_line; |
|---|
| 251 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<match url=\".\" ignoreCase=\"false\" />".$end_of_line; |
|---|
| 252 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent.$indent."<action type=\"Rewrite\" url=\"index.php\" />".$end_of_line; |
|---|
| 253 | + $rules .= $extra_indent.$indent.$indent.$indent.$indent."</rule>".$end_of_line; |
|---|
| 254 | } |
|---|
| 255 | - } else { |
|---|
| 256 | - $siteurl = get_option( 'siteurl' ); |
|---|
| 257 | - $siteurl_len = strlen( $siteurl ); |
|---|
| 258 | - if ( substr( WP_CONTENT_URL, 0, $siteurl_len ) == $siteurl && strlen( WP_CONTENT_URL ) > $siteurl_len ) |
|---|
| 259 | - $content_path = substr( WP_CONTENT_URL, $siteurl_len + 1 ); |
|---|
| 260 | - else |
|---|
| 261 | - $content_path = 'wp-content'; |
|---|
| 262 | - $rules = '<rule name="wordpress - strip index.php" stopProcessing="false"> |
|---|
| 263 | - <match url="^index.php/(.*)$" /> |
|---|
| 264 | - <action type="Rewrite" url="{R:1}" /> |
|---|
| 265 | - </rule> |
|---|
| 266 | - <rule name="wordpress - 1" stopProcessing="true"> |
|---|
| 267 | - <match url="^(.*/)?files/$" /> |
|---|
| 268 | - <action type="Rewrite" url="index.php" /> |
|---|
| 269 | - </rule> |
|---|
| 270 | - <rule name="wordpress - 2" stopProcessing="true"> |
|---|
| 271 | - <match url="^(.*/)?files/(.*)" /> |
|---|
| 272 | - <conditions> |
|---|
| 273 | - <add input="{REQUEST_URI}" negate="true" pattern=".*' . $content_path . '/plugins.*"/> |
|---|
| 274 | - </conditions> |
|---|
| 275 | - <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" /> |
|---|
| 276 | - </rule> |
|---|
| 277 | - <rule name="wordpress - 3" stopProcessing="true"> |
|---|
| 278 | - <match url="^(.+)$" /> |
|---|
| 279 | - <conditions> |
|---|
| 280 | - <add input="{REQUEST_URI}" pattern="^.*/wp-admin$" /> |
|---|
| 281 | - </conditions> |
|---|
| 282 | - <action type="Redirect" url="{R:1}/" redirectType="Permanent" /> |
|---|
| 283 | - </rule> |
|---|
| 284 | - <rule name="wordpress - 4" stopProcessing="true"> |
|---|
| 285 | - <match url="."/> |
|---|
| 286 | - <conditions logicalGrouping="MatchAny"> |
|---|
| 287 | - <add input="{REQUEST_FILENAME}" matchType="IsFile" pattern="" /> |
|---|
| 288 | - <add input="{REQUEST_FILENAME}" matchType="IsDirectory" pattern="" /> |
|---|
| 289 | - </conditions> |
|---|
| 290 | - <action type="None" /> |
|---|
| 291 | - </rule> |
|---|
| 292 | - <rule name="wordpress - 5" stopProcessing="true"> |
|---|
| 293 | - <match url="^([_0-9a-zA-Z-]+/)?(wp-.*)" /> |
|---|
| 294 | - <action type="Rewrite" url="{R:2}" /> |
|---|
| 295 | - </rule> |
|---|
| 296 | - <rule name="wordpress - 6" stopProcessing="true"> |
|---|
| 297 | - <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" /> |
|---|
| 298 | - <action type="Rewrite" url="{R:2}" /> |
|---|
| 299 | - </rule> |
|---|
| 300 | - <rule name="wordpress - 7" stopProcessing="true"> |
|---|
| 301 | - <match url="." /> |
|---|
| 302 | - <action type="Rewrite" url="index.php" /> |
|---|
| 303 | - </rule>'; |
|---|
| 304 | } |
|---|
| 305 | - |
|---|
| 306 | + if ( $add_parent_tags ) { |
|---|
| 307 | + $rules .= $end_of_line.$indent.$indent.$indent."</rules>".$end_of_line; |
|---|
| 308 | + $rules .= $indent.$indent."</rewrite>".$end_of_line; |
|---|
| 309 | + $rules .= $indent."</system.webServer>".$end_of_line; |
|---|
| 310 | + $rules .= "</configuration>"; |
|---|
| 311 | + } |
|---|
| 312 | $rules = apply_filters('iis7_url_rewrite_rules', $rules); |
|---|
| 313 | |
|---|
| 314 | return $rules; |
|---|