If 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>
Reblogged this on RJ Solusoft.
LikeLike
Thanks so much for this – I was pulling my hair out!
LikeLike
Reblogged this on Rajesh Bhujbal's Blog.
LikeLike
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!!
LikeLike
Your web.config is really successful. Thanks, dude 🙂
LikeLike
Thanks! It took some time to get the right settings, but so far so good!
LikeLike
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..
LikeLike
Thanks for the web.config file man. You saved me.
LikeLike
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.
LikeLike
[…] this post and this post, I was able to assemble the following rewrite rules that have worked for my WPMU […]
LikeLike