IIS URL重写在第一个正斜杠后不起作用,但URL转发工作正常

Joh*_*ohn 5 iis url-rewriting

因此,如果我输入一个URL:http://sample.com/maindir/test123,我的Rewrite工作正常.如果我输入的网址如下:http://sample.com/maindir/test123/test234它会中断,给出500错误.如果我将其更改为重定向而不是重写规则,则这两个都有效

<rule name="Test" stopProcessing="true">
    <match url="^maindir\/?(?:([^\/]+))?\/?(?:([^\/]+))?\/?(?:([^\/]+))?\/?(?:([^\/]+))?\/?" />
    <action type="Rewrite" url="maindir/?a1[]={R:1}&amp;a1[]={R:2}&amp;a1[]={R:3}&amp;a1[]={R:4}" />
    <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
</rule>
Run Code Online (Sandbox Code Playgroud)

在对此非常沮丧之后,试图找到解决方案,我想我会看到是否有其他人可以看到这里发生了什么.先感谢您.