It’s important to use the correct URL Rewrite Rules for WordPress and IIS, otherwise we might see HTTP 404 and HTTP 500 status codes when requesting images and pages.
An example of a working URL rewrite rule is below:
<rules>
<rule name="Rule 1" stopProcessing="true">
<match url="^index\.php$" ignoreCase="false"/>
<action type="None"/>
</rule>
<rule name="Rule 2" stopProcessing="true">
<match url=".*\.(gif|jpg|jpeg|png|css|js)$" ignoreCase="true"/>
<action type="Rewrite" url="{R:0}"/>
</rule>
<rule name="Rule 3" stopProcessing="true">
<match url="." ignoreCase="false"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true"/>
</conditions>
<action type="Rewrite" url="/index.php"/>
</rule>
</rules>