IIS URL重写-匹配模式
我正在尝试重写路径folder1/folder2/folder3。。。 去 我目前有以下模式:^[^/]+/?[^/]+/?[^/]+/?[^/]+/?[^/]+/$这在4级深度文件夹结构中正常工作。然而,由于文件夹的数量应该有所不同,我想知道是否有一种模式不限制我对URL中的许多文件夹进行“硬编码”。IIS URL重写-匹配模式,iis,url-rewriting,Iis,Url Rewriting,我正在尝试重写路径folder1/folder2/folder3。。。 去 我目前有以下模式:^[^/]+/?[^/]+/?[^/]+/?[^/]+/?[^/]+/$这在4级深度文件夹结构中正常工作。然而,由于文件夹的数量应该有所不同,我想知道是否有一种模式不限制我对URL中的许多文件夹进行“硬编码”。 谢谢这可能不是您想要的,但基于您的示例,它会起作用 <rule name="ExampleRule" stopProcessing="true"> <match url="
谢谢这可能不是您想要的,但基于您的示例,它会起作用
<rule name="ExampleRule" stopProcessing="true">
<match url="^.+$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="/default.aspx?id={R:1}" />
</rule>
<rule name="ExampleRule" stopProcessing="true">
<match url="^.+$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="/default.aspx?id={R:1}" />
</rule>