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

Google Analytics Custom Report Filters – RegEx

google_analytics_logoIf you’ve noticed,¬†Google Analytics doesn’t seem to allow you to filter on standard reports using multiple dimensions if you’re only showing one. You can easily create a custom report and add your filters using multiple dimensions and only show one. However, many users get scared by the RegEx option under Filters (the only other choice is Exact). It’s not that complex, below is a simple example showing multiple filters using a simple RegEx ‘contains’. Continue reading “Google Analytics Custom Report Filters – RegEx”

Google Analytics Custom Report Filters – RegEx

Disable ‘Compatibility Mode’ in Internet Explorer (IE) 8 / 9

compatibilty-modeOver the past few months you put tons of time and effort into your awesome new site. However, your roll it live and find out that someone¬†accidentally¬†has¬†Compatibility Mode mode in IE turned on. Now your scripts don’t function exactly how you imagined and your layout is acting funky. There are some Meta tags that apparently take care of this if you add them to your page (<meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″ />) but personally I haven’t had great success with these. Below is the way I found best in .net to disable and turn off¬†Compatibility Mode in IE:

On your page (preferably master page in web forms or mvc) add this line:

<% Response.AddHeader(“X-UA-Compatible”, “IE=edge,chrome=1”); %>

In my case I’m adding it below the¬†<%@ Master Language=”C#” … line before the start of content (doctype).

Update: You can also easily add the header in IIS (no need to update your code) by going to ‘http response headers’ and choosing ‘add’:

iis_comp-view

 

 

 

Disable ‘Compatibility Mode’ in Internet Explorer (IE) 8 / 9