1

I currently have a working wordpress installation in my server root, but now I'm adding another wordpress site to subfolder "new-site".

It's an IIS server, so the web.config file should have this in the root directory, according to wordpress:

<configuration>
    <system.webServer>
        <rewrite>
            <rules>
            <rule name="wordpress" patternSyntax="Wildcard">
                <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                <action type="Rewrite" url="index.php" />
            </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

The problem I'm facing now: How to modify the root's web.config file (below) so that the WP installation in /new-site works fine. (It's working fine on my localhost and I've changed the URLs in wp-options. The homepage on new-site looks fine but if you click on any link it'll be an error page of the root site.) Thanks!

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="4294967295" />
            </requestFiltering>
        </security>

        <rewrite>
            <rules>
                <rule name="Main Rule" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
                <rule name="wordpress" patternSyntax="Wildcard">
                    <match url="*" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>

        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="index.html" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="aboutus.html" />
            </files>
        </defaultDocument>

        <handlers>
            <remove name="PHP53_via_FastCGI" />
            <remove name="AboMapperCustom-1045478" />
            <add name="PHP53_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.3\php-cgi.exe" resourceType="Either" requireAccess="Script" />
        </handlers>   
    </system.webServer>
</configuration>

1 Answer 1

7

Solved. In the web.config in the subfolder, add <clear /> so it won't be affected by the root's rule(s).

<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="wordpress" patternSyntax="Wildcard">
            <match url="*" />
              <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
              </conditions>
            <action type="Rewrite" url="index.php" />
          </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Source: http://forums.iis.net/post/1883731.aspx

2
  • Can you please post your final webconfig for both the root application and the subdirectory. I keep getting a 500.19 error and have tried all sorts of combinations with no luck so far!
    – Raj
    Jun 1, 2016 at 7:27
  • Thank you, It worked and saved a lot of time :)
    – Khushi
    Jun 14 at 7:59

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.