如何排除IIS URL重写的目录?

Arj*_*jen 13 iis url iis-7 rewrite url-rewrite-module

我有一个domain.com/index.php和一个友好的网址规则来重定向domain.com/index.php?s=?要求.我使用带有URL重写附加组件的IIS webserver.

以上工作正常.但是,对admin目录的请求存在问题...

我还有domain.com/admin/cloud/index.php,有时需要获取或发送数据(通过Ajax).当规则处于活动状态时,数据不可用,当我删除上述规则时,数据可用.

如何使用上面的网址规则并排除域名(或)域名内容中的所有其他请求?

这是我目前的规则集:

<rule name="RedirectUserFriendlyURL1" stopProcessing="true">
    <match url="^index\.php$" />
    <conditions>
        <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
        <add input="{QUERY_STRING}" pattern="^s=([^=&amp;]+)$" />
    </conditions>
    <action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
    <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?s={R:1}" />
</rule>
Run Code Online (Sandbox Code Playgroud)

我尝试了很多方法,包括路径信息......但没有成功.也许有人可以暗示一下?

谢谢!

Tas*_* K. 29

看一下这里你可以添加这个规则,这样当你不想处理的请求到来时,你可以忽略它并停止处理.

它应该首先放置,以便此规则在其他两个之前执行.

<rule name="block" stopProcessing="true">
    <match url="^admin/cloud/index.php$" />
    <action type="None" />
</rule>
Run Code Online (Sandbox Code Playgroud)