I have two file web.config from wordpress setting like this:
<?xml version="1.0" encoding="UTF-8"?>
<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>
I want to add some exception like if in folder wordpress, that rule is not running.
In my case, I have 2 wordpress installed with setting->permanentlinks->Post Name, 1 in root directory (http://example.com/) and other in /wordpress (http://example.com/wordpress) directory.
The second wordpress (/wordpress) I change web.config rule name="wordpress2" and it work, but if I want to view sample-page (http://example.com/wordpress/sample-page) than the page redirect to 404 Page Not Found.
Change match url showing below, hope this will help.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<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>
</rules>
</rewrite>
</system.webServer>
</configuration>