Fix code vomit in IIS rewrite rule generation. fixes #22920 for trunk. props toscho.

git-svn-id: http://core.svn.wordpress.org/trunk@23177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith 2012-12-13 22:54:36 +00:00
parent 11e2073d89
commit 21963e265a
1 changed files with 10 additions and 12 deletions

View File

@ -411,8 +411,7 @@ define('BLOG_ID_CURRENT_SITE', 1);
$iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base; $iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base;
$iis_subdir_replacement = $subdomain_install ? '' : '{R:1}'; $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}';
$web_config_file = <<<EOF $web_config_file = '<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<system.webServer> <system.webServer>
<rewrite> <rewrite>
@ -424,14 +423,14 @@ define('BLOG_ID_CURRENT_SITE', 1);
if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
$web_config_file .= ' $web_config_file .= '
<rule name="WordPress Rule for Files" stopProcessing="true"> <rule name="WordPress Rule for Files" stopProcessing="true">
<match url="^{$iis_subdir_match}files/(.+)" ignoreCase="false" /> <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" />
<action type="Rewrite" url="{$iis_rewrite_base}wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> <action type="Rewrite" url="' . $iis_rewrite_base . 'wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />
</rule>'; </rule>';
} }
$web_config_file .= ' $web_config_file .= '
<rule name="WordPress Rule 2" stopProcessing="true"> <rule name="WordPress Rule 2" stopProcessing="true">
<match url="^{$iis_subdir_match}wp-admin$" ignoreCase="false" /> <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" />
<action type="Redirect" url="{$iis_subdir_replacement}wp-admin/" redirectType="Permanent" /> <action type="Redirect" url="' . $iis_subdir_replacement . 'wp-admin/" redirectType="Permanent" />
</rule> </rule>
<rule name="WordPress Rule 3" stopProcessing="true"> <rule name="WordPress Rule 3" stopProcessing="true">
<match url="^" ignoreCase="false" /> <match url="^" ignoreCase="false" />
@ -442,12 +441,12 @@ define('BLOG_ID_CURRENT_SITE', 1);
<action type="None" /> <action type="None" />
</rule> </rule>
<rule name="WordPress Rule 4" stopProcessing="true"> <rule name="WordPress Rule 4" stopProcessing="true">
<match url="^{$iis_subdir_match}(wp-(content|admin|includes).*)" ignoreCase="false" /> <match url="^' . $iis_subdir_match . '(wp-(content|admin|includes).*)" ignoreCase="false" />
<action type="Rewrite" url="{$iis_rewrite_base}{R:1}" /> <action type="Rewrite" url="' . $iis_rewrite_base . '{R:1}" />
</rule> </rule>
<rule name="WordPress Rule 5" stopProcessing="true"> <rule name="WordPress Rule 5" stopProcessing="true">
<match url="^{$iis_subdir_match}([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> <match url="^' . $iis_subdir_match . '([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
<action type="Rewrite" url="{$iis_rewrite_base}{R:2}" /> <action type="Rewrite" url="' . $iis_rewrite_base . '{R:2}" />
</rule> </rule>
<rule name="WordPress Rule 6" stopProcessing="true"> <rule name="WordPress Rule 6" stopProcessing="true">
<match url="." ignoreCase="false" /> <match url="." ignoreCase="false" />
@ -456,8 +455,7 @@ define('BLOG_ID_CURRENT_SITE', 1);
</rules> </rules>
</rewrite> </rewrite>
</system.webServer> </system.webServer>
</configuration> </configuration>';
EOF;
?> ?>
<li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), $home_path ); ?></p> <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), $home_path ); ?></p>