Problem with multisite virtual domains in IIS

I've run into an interesting problem moving my sites from LAMP to IIS. Although my first set of sites moved perfectly, I'm having some virutal hosting issues.

In particular, I have one MU installation with two domains: zdecade.com and trackyourcandidate.com. ZDecade.com is the main, install domain. I can successfully go to zdecade.com and any WP-managed subdirectory, like zdecade.com/wp-admin.

However, when I try to go to any pages on the trackyourcandidate site, like, say trackyourcandidate/governor, IIS tries feeding http://trackyourcandidate.com:80/governor/ as the requested URL and looks for it at the physical path of C:\VirtualHosts\wpmu-zdecade\governor\

The graphic attached shows more examples of this, in some detail. Right now, I'm testing this on a test system, using the hosts file to allow me to test all this domain stuff without hurting my production machine.

I'm NOT running any host naming or virtual host plug-in.

Any suggestions would be very appreciated.

Thanks!

The attachment tool doesn't like me, but here's a Dropbox link to the image: Detail Image

  • David

    Okay, it took a while, but I found what seems to work. There's a file called web.config (basically IIS's equivalent to htaccess) that's necessary to make make this work. WordPress generates a web.config file, but it's wrong. Instead, you should use this, placing the file in the root directory of your multisite WordPress install:

    <?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-]+/)?files/(.+)" ignoreCase="false" />
                        <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
                    </rule>
                    <rule name="WordPress Rule 3" 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 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" />
                        </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:2}" />
                    </rule>
                    <rule name="WordPress Rule 6" stopProcessing="true">
                        <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                        <action type="Rewrite" url="{R:2}" />
                    </rule>
                    <rule name="WordPress Rule 7" stopProcessing="true">
                        <match url="." ignoreCase="false" />
                        <action type="Rewrite" url="index.php" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>

    Credit goes to WordPress.org member naupadarna:
    http://wordpress.org/support/topic/multisite-install?replies=4#post-2198998

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.