• I have installed WP 3.9.1, 3.9.2, and 4.0 and set up as a multisite. I tested with 2 different Windows servers. One server is local, the other is hosted. The local server is running IIS 7 and the hosted server is running IIS 8. I had no issues with the install and no errors show in the log or on the page. However, when I create a new sub-site, I get a 404 on the back end and a page with no theme or styles on the front end.

    I searched for resolutions and found a lot of discussion about this but no solutions except for one that was posted 3 years ago (link below). However, there is no explanation of why this is happening. I don’t understand how this is still an issue 3 years later with a baseline install of WordPress. There is also no mention of it anywhere in the codex (that I could find).

    The fix is to overwrite your web.config file with new code given in the support topics linked below. So, the auto generated code you get when setting up the multisite is incorrect. This is a bug.

    Can someone please look at this and tell me why the solution below works? Hopefully the WordPress folks will pick up on this and put a fix in for it in the next version. This took many hours to find. Thanks.

    https://www.ads-software.com/support/topic/multisite-on-iis?replies=6
    https://www.ads-software.com/support/topic/multisite-install?replies=4#post-2198998

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Did you create a new web.config or .htaccess file with the new IIS rules after activating multisite?

    Thread Starter zmagicx

    (@zmagicx)

    Yes, I updated my web.config with the auto generated code from WordPress when setting up the multisite. When this didn’t work, I tried multiple solutions found by browsing these forums. The only one that worked was the one from this post and it worked on both servers with two different versions of IIS. I appreciated the post but, I want to understand why this works and the code generated by WordPress doesn’t.

    I am posting the code that didn’t work below. This code was auto generated by WordPress for the web.config file when setting up the multisite. I have looked at the differences between the two sets of code but, I don’t understand them. Can someone translate? Thanks.

    DO NOT USE THIS CODE:

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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    There’s only one difference I see:

    <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>

    And THAT is just for images on older installs of WP (shouldn’t matter at all here)

    Thread Starter zmagicx

    (@zmagicx)

    Thanks Ipstenu. I didn’t know that was for images on old installs of WP. That is interesting.

    I found another difference but, I am not sure what it means. I it is a bit smaller than the one you found and it’s also under another rule number so it’s hard to notice. Here it is below. It’s under WordPress Rule 4 in the old code (Rule 6 in the new code). The rewrite rule was changed from R:1 to R:2.

    I am not sure if the R:1 is a variable for Rule 1 and R:2 is variable Rule 2? But if it is, then that is the rule you noticed was rewritten. If not can you tell me what it means? Thanks again for your help with understanding this.

    OLD

    <rule name="WordPress Rule 4" stopProcessing="true">
    <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
    <action type="Rewrite" url="{R:1}" />
    </rule>

    NEW

    <rule name="WordPress Rule 6" stopProcessing="true">
    <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
    <action type="Rewrite" url="{R:2}" />
    </rule>

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Ah okay. The R:# has to do with replacement strings.

    *hrm* That’s interesting.

    One server is local, the other is hosted. The local server is running IIS 7 and the hosted server is running IIS 8.

    And this fails on both?

    Thread Starter zmagicx

    (@zmagicx)

    Yes, it fails on both. The site loads but with no styles or evidence of a theme. The admin gives a 404 error.

    Also, I am sorry but, I copied the wrong rule above. It’s actually this one below:

    <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>

    Thanks.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Which rule was wrong? Thatis, is the one you pasted above the NEW or OLD one?

    Thread Starter zmagicx

    (@zmagicx)

    Sorry for the confusion. The new code is the code that works. The code linked above from the other forum post. The old code is the auto-generated code from WP. Here they are again side by side.

    It’s a good thing you asked again because I just noticed another subtle difference. The caret is outside the parenthesis in the old code and inside the parenthesis in the new code in the match url statement. Thanks.

    OLD (Auto-generated from WP)

    <rule name="WordPress Rule 4" stopProcessing="true">
    <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
    <action type="Rewrite" url="{R:1}" />
    </rule>

    NEW (Copied from forum post linked above)

    <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>

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Well now…. That’s weird. The .htaccess rule is this:

    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]

    Can you test if this works?

    <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>
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Multisite baseline install on iis gives 404 and no theme’ is closed to new replies.