WordPress Multisite Windows / IIS Login Redirect / Loop Issue

wp_logoIf you have WordPress installed on Windows (2008 / IIS) with multisite + sub domains enabled you may have run into the issue of login loops / redirects when  accessing /wp-admin. Below are a few spots you may want to confirm you have the correct URLs:

In the database:

Table / Field

wp_blogs / domain
wp_options / siteurl
wp_options / home
wp_sitemeta / siteurl    (don't forget this one!)

Also check these tables in any additional sites (ie: wp_2_options).

Config Files
wp-config.php:

define('DOMAIN_CURRENT_SITE', 'www.yourdomain.com');

I also have this in my wp-config.php:

define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

Web Config
Below is my successful web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="WordPress Rule 1" stopProcessing="true">
          <match url="^index\.php$" ignoreCase="false" />
          <action type="None" />
        </rule>
        <rule name="WordPress Rule 2" stopProcessing="true">
          <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
          <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
        </rule>
        <rule name="WordPress Rule 3" stopProcessing="true">
          <match url="^" ignoreCase="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
          </conditions>
          <action type="None" />
        </rule>
        <rule name="WordPress Rule 4" stopProcessing="true">
          <match url="^" ignoreCase="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
            <add input="{URL}" pattern="([a-zA-Z0-9\./_-]+)\.axd" />
          </conditions>
          <action type="None" />
        </rule>
        <rule name="WordPress Rule 5" stopProcessing="true">
          <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" />
          <action type="Rewrite" url="{R:1}" />
        </rule>
        <rule name="WordPress Rule 6" stopProcessing="true">
          <match url="." ignoreCase="false" />
          <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
    <httpRedirect enabled="false" destination="http://www.yourdomain.com" />
  </system.webServer>
</configuration>
WordPress Multisite Windows / IIS Login Redirect / Loop Issue

10 thoughts on “WordPress Multisite Windows / IIS Login Redirect / Loop Issue

  1. Oh my goodness! Incredible article dude! Thank you, However I am encountering difficulties with your RSS.
    I don’t understand why I cannot subscribe to it. Is there anyone else getting the same RSS issues? Anyone that knows the answer can you kindly respond? Thanks!!

    Like

  2. Much Thanks to you Dear , It worked .

    However, I did a little more tweak on your web.config file to make it work.
    I added a ? in the Rule 5. (wp-(content|admin|includes)?.*)

    I think, its because of update in url rewriting rules.
    Without the tweat, I was to able to get rid of the reidrect loop issue. Much Much Thanks..

    Like

  3. mattl320 says:

    Thanks brother. Everyone is posting the fix for those running into the error for Apache servers. Yours was the first I found with a successful web.config. Fixed my issue. Much thanks.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s