Multisite setup on IIS with subdomains

I have WordPress 3.4.2 set up on a Windows 2008 R2 server with IIS 7.5. I enabled multisite using subdomains and set up one additional site, call it child.example.com. I can browse to the main site at example.com just fine, but whenever I browse to child.example.com it tries to go to the default web site in IIS, which has ID 1 and currently points to an empty directory. The main WordPress site is one that was manually added to IIS, and its ID is 3. I created entries in my hosts file on the server for the main site and the child site, and they seem correct (I don’t have access to our DNS provider at the moment).

In trying to figure this out, I keep coming back to these entries for wp-config.php:

define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

These seem to tell WordPress the ID of the site where it will live. My question is what does that number represent? Does it have any correlation to site IDs in IIS? If I change it from 1 to 3, would that tell WordPress to use the proper site when accessing its subdomains?

EDIT:
It seems that those numbers might refer to the values in the site_id and blog_id fields in the wp_blogs table, specifically for the record associated with the main site. I tried changing them to 3 in wp-config and bouncing IIS, but that had no effect.

So now my question becomes, how can I get WordPress to look to its own IIS site when a request comes in for a sub-site, versus looking at the site designated as the ‘default’ in IIS?

1 Answer
1

I finally figure it out. I was missing a binding on my main WordPress site in IIS. I needed to add one for the sub-site, in this case child.example.com, specifying the same IP. After doing that I could successfully browse to the sub-site. Presumably when IIS can’t find any matching binding for the given host name, it just reverts to the default site.

Leave a Comment